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

Side by Side 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, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/isolate/trace_inputs.py » ('j') | tools/isolate/trace_inputs.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Waits for the go signal and replaces itself with the command to be run. 6 """Waits for the go signal and replaces itself with the command to be run.
cmp 2012/06/04 22:15:34 This should be updated now that on windows it does
M-A Ruel 2012/06/04 23:18:06 Thanks, also added comment about 'why' it is used.
7 7
8 Not meant to be used directly, only meant to be used by trace_inputs.py. 8 Not meant to be used directly, only meant to be used by trace_inputs.py.
9 """ 9 """
10 10
11 import os
12 import subprocess 11 import subprocess
13 import sys 12 import sys
14 13
15 14
16 def main(): 15 def main():
17 signal = 'Go!'
18 value = sys.stdin.read(len(signal))
19 assert value == signal
20 sys.stdin.close()
21 # Replace the executable with an absolute path to make it easier to grok.
22 cmd = sys.argv[1:] 16 cmd = sys.argv[1:]
23 cmd[0] = os.path.abspath(cmd[0]) 17 if sys.argv[1] == '--wait':
24 if cmd[0].endswith('.py'): 18 cmd = cmd[1:]
25 cmd.insert(0, sys.executable) 19 signal = 'Go!'
26 p = subprocess.Popen(cmd) 20 value = sys.stdin.read(len(signal))
27 #print 'Child pid: %d' % p.pid 21 assert value == signal
28 p.wait() 22 sys.stdin.close()
29 return p.returncode 23
24 # The reason os.execve() is not used is that we don't want the modules
25 # imported here to influence the executable being traced, so we need a fresh
26 # pid and need to fork.
27 return subprocess.call(cmd)
30 28
31 29
32 if __name__ == '__main__': 30 if __name__ == '__main__':
33 sys.exit(main()) 31 sys.exit(main())
OLDNEW
« 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