Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Unified Diff: tools/isolate/trace_child_process.py

Issue 10448044: Use trace_child_process.py on Windows and save information about the trace in json. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/isolate/trace_inputs.py » ('j') | tools/isolate/trace_inputs.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/isolate/trace_child_process.py
diff --git a/tools/isolate/trace_child_process.py b/tools/isolate/trace_child_process.py
index 3a8367bbbaa2462fcf8cebb9b400b68babb8b236..97fd073ddabd74d9e29ac070ce1b4280f15017bd 100755
--- a/tools/isolate/trace_child_process.py
+++ b/tools/isolate/trace_child_process.py
@@ -8,25 +8,23 @@
Not meant to be used directly, only meant to be used by trace_inputs.py.
"""
-import os
import subprocess
import sys
def main():
- signal = 'Go!'
- value = sys.stdin.read(len(signal))
- assert value == signal
- sys.stdin.close()
- # Replace the executable with an absolute path to make it easier to grok.
cmd = sys.argv[1:]
- cmd[0] = os.path.abspath(cmd[0])
- if cmd[0].endswith('.py'):
- cmd.insert(0, sys.executable)
- p = subprocess.Popen(cmd)
- #print 'Child pid: %d' % p.pid
- p.wait()
- return p.returncode
+ if sys.argv[1] == '--wait':
+ cmd = cmd[1:]
+ signal = 'Go!'
+ value = sys.stdin.read(len(signal))
+ assert value == signal
+ sys.stdin.close()
+
+ # The reason os.execve() is not used is that we don't want the modules
+ # imported here to influence the executable being traced, so we need a fresh
+ # pid and need to fork.
+ return subprocess.call(cmd)
if __name__ == '__main__':
« no previous file with comments | « no previous file | tools/isolate/trace_inputs.py » ('j') | tools/isolate/trace_inputs.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698