sigtrace: ignore errors writing sigtrace files

Summary:
Errors could occur with various reasons. Such as permissions.
Not having periodical sigtrace does not affect correctness, so let's just
ignore errors.

Reviewed By: singhsrb

Differential Revision: D26192199

fbshipit-source-id: 8d2dba56979efd121c9bdc757895e86aa23d6694
This commit is contained in:
Jun Wu 2021-02-02 10:28:07 -08:00 committed by Facebook GitHub Bot
parent 9d8041d04d
commit a1509b71e4

View File

@ -123,13 +123,16 @@ def reposetup(ui, repo):
return
def writesigtracethread(path, interval):
dir = os.path.dirname(path)
util.makedirs(dir)
while True:
time.sleep(interval)
# Keep 10 minutes of sigtraces.
util.gcdir(dir, 60 * 10)
writesigtrace(path)
try:
dir = os.path.dirname(path)
util.makedirs(dir)
while True:
time.sleep(interval)
# Keep 10 minutes of sigtraces.
util.gcdir(dir, 60 * 10)
writesigtrace(path)
except Exception:
pass
path = repo.localvfs.join("sigtrace", "pid-%s-%s" % (os.getpid(), ui.cmdname))
thread = threading.Thread(