Index: tools/isolate/trace_inputs.py |
diff --git a/tools/isolate/trace_inputs.py b/tools/isolate/trace_inputs.py |
index 78918a6800c3e133f9c8cedb1df29131f2c47901..f49b8155b2250003fa389292bc0f822bc2cfe689 100755 |
--- a/tools/isolate/trace_inputs.py |
+++ b/tools/isolate/trace_inputs.py |
@@ -389,6 +389,12 @@ class Strace(object): |
else: |
self.non_existent.add(filepath) |
+ @staticmethod |
+ def clean_trace(logname): |
+ """Deletes the old log.""" |
+ if os.path.isfile(logname): |
+ os.remove(logname) |
MAD
2012/05/11 18:51:38
Shouldn't we try to catch these?
"On Windows, att
M-A Ruel
2012/05/11 18:57:25
I prefer the script to crash if the files can't be
|
+ |
@classmethod |
def gen_trace(cls, cmd, cwd, logname, output): |
"""Runs strace on an executable.""" |
@@ -699,6 +705,12 @@ class Dtrace(object): |
def _handle_ignored(_ppid, pid, function, args, result): |
logging.debug('%d %s(%s) = %s' % (pid, function, args, result)) |
+ @staticmethod |
+ def clean_trace(logname): |
+ """Deletes the old log.""" |
+ if os.path.isfile(logname): |
+ os.remove(logname) |
+ |
@classmethod |
def gen_trace(cls, cmd, cwd, logname, output): |
"""Runs dtrace on an executable.""" |
@@ -1013,6 +1025,14 @@ class LogmanTrace(object): |
self.IGNORED.add('\\systemroot') |
self.IGNORED = tuple(sorted(self.IGNORED)) |
+ @staticmethod |
+ def clean_trace(logname): |
+ """Deletes the old log.""" |
+ if os.path.isfile(logname): |
+ os.remove(logname) |
+ if os.path.isfile(logname + '.etl'): |
+ os.remove(logname + '.etl') |
+ |
@classmethod |
def gen_trace(cls, cmd, cwd, logname, output): |
logging.info('gen_trace(%s, %s, %s, %s)' % (cmd, cwd, logname, output)) |
@@ -1338,8 +1358,7 @@ def trace(logfile, cmd, cwd, api, output): |
""" |
cmd = fix_python_path(cmd) |
assert os.path.isabs(cmd[0]), cmd[0] |
- if os.path.isfile(logfile): |
- os.remove(logfile) |
+ api.clean_trace(logfile) |
return api.gen_trace(cmd, cwd, logfile, output) |