OLD | NEW |
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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() == 'linux': | 70 if getos.GetPlatform() == 'linux': |
71 cmd = ['xterm', '-title', 'NaCl Debugger', '-e'] | 71 cmd = ['xterm', '-title', 'NaCl Debugger', '-e'] |
72 cmd += options.debug | 72 cmd += options.debug |
73 elif getos.GetPlatform() == 'mac': | 73 elif getos.GetPlatform() == 'mac': |
74 cmd = ['osascript', '-e', | 74 cmd = ['osascript', '-e', |
75 'tell application "Terminal" to do script "%s"' % | 75 'tell application "Terminal" to do script "%s"' % |
76 ' '.join(r'\"%s\"' % x for x in options.debug)] | 76 ' '.join(r'\"%s\"' % x for x in options.debug)] |
77 else: | 77 elif getos.GetPlatform() == 'win': |
78 cmd = [] | 78 cmd = ['cmd.exe', '/c', 'start', 'cmd.exe', '/c'] |
| 79 cmd += options.debug |
79 print 'Starting debugger: ' + ' '.join(cmd) | 80 print 'Starting debugger: ' + ' '.join(cmd) |
80 debug_process = subprocess.Popen(cmd, env=env) | 81 debug_process = subprocess.Popen(cmd, env=env) |
81 else: | 82 else: |
82 debug_process = False | 83 debug_process = False |
83 | 84 |
84 try: | 85 try: |
85 return server.ServeUntilSubprocessDies(process) | 86 return server.ServeUntilSubprocessDies(process) |
86 finally: | 87 finally: |
87 if process.returncode is None: | 88 if process.returncode is None: |
88 process.kill() | 89 process.kill() |
89 if debug_process and debug_process.returncode is None: | 90 if debug_process and debug_process.returncode is None: |
90 debug_process.kill() | 91 debug_process.kill() |
91 | 92 |
92 if __name__ == '__main__': | 93 if __name__ == '__main__': |
93 sys.exit(main(sys.argv[1:])) | 94 sys.exit(main(sys.argv[1:])) |
OLD | NEW |