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

Side by Side Diff: native_client_sdk/src/tools/run.py

Issue 86053005: [NaCl SDK] Fix "make debug" and "make run" on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: feedback Created 7 years 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 | « native_client_sdk/src/tools/getos.py ('k') | native_client_sdk/src/tools/tests/getos_test.py » ('j') | no next file with comments »
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 """Launch a local server on an ephemeral port, then launch a executable that 6 """Launch a local server on an ephemeral port, then launch a executable that
7 points to that server. 7 points to that server.
8 """ 8 """
9 9
10 import copy 10 import copy
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 for e in options.environ: 60 for e in options.environ:
61 key, value = map(str.strip, e.split('=')) 61 key, value = map(str.strip, e.split('='))
62 env[key] = value 62 env[key] = value
63 63
64 cmd = args + [server.GetURL(options.path)] 64 cmd = args + [server.GetURL(options.path)]
65 print 'Running: %s...' % (' '.join(cmd),) 65 print 'Running: %s...' % (' '.join(cmd),)
66 process = subprocess.Popen(cmd, env=env) 66 process = subprocess.Popen(cmd, env=env)
67 67
68 # If any debug args are passed in, assume we want to debug 68 # If any debug args are passed in, assume we want to debug
69 if options.debug: 69 if options.debug:
70 if getos.GetPlatform() != 'win': 70 if getos.GetPlatform() == 'linux':
71 cmd = ['xterm', '-title', 'NaCl Debugger', '-e'] 71 cmd = ['xterm', '-title', 'NaCl Debugger', '-e']
72 cmd += options.debug
73 elif getos.GetPlatform() == 'mac':
74 cmd = ['osascript', '-e',
75 'tell application "Terminal" to do script "%s"' %
76 ' '.join(r'\"%s\"' % x for x in options.debug)]
72 else: 77 else:
73 cmd = [] 78 cmd = []
74 cmd += options.debug
75 print 'Starting debugger: ' + ' '.join(cmd) 79 print 'Starting debugger: ' + ' '.join(cmd)
76 debug_process = subprocess.Popen(cmd, env=env) 80 debug_process = subprocess.Popen(cmd, env=env)
77 else: 81 else:
78 debug_process = False 82 debug_process = False
79 83
80 try: 84 try:
81 return server.ServeUntilSubprocessDies(process) 85 return server.ServeUntilSubprocessDies(process)
82 finally: 86 finally:
83 if process.returncode is None: 87 if process.returncode is None:
84 process.kill() 88 process.kill()
85 if debug_process and debug_process.returncode is None: 89 if debug_process and debug_process.returncode is None:
86 debug_process.kill() 90 debug_process.kill()
87 91
88 if __name__ == '__main__': 92 if __name__ == '__main__':
89 sys.exit(main(sys.argv[1:])) 93 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « native_client_sdk/src/tools/getos.py ('k') | native_client_sdk/src/tools/tests/getos_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698