OLD | NEW |
1 # Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """This is the Mac implementation of the layout_package.platform_utils | 5 """This is the Mac implementation of the layout_package.platform_utils |
6 package. This file should only be imported by that package.""" | 6 package. This file should only be imported by that package.""" |
7 | 7 |
8 import os | 8 import os |
9 import platform | 9 import platform |
10 import signal | 10 import signal |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 if server_process is None: | 97 if server_process is None: |
98 # TODO(mmoss) This isn't ideal, since it could conflict with lighttpd | 98 # TODO(mmoss) This isn't ideal, since it could conflict with lighttpd |
99 # processes not started by http_server.py, but good enough for now. | 99 # processes not started by http_server.py, but good enough for now. |
100 | 100 |
101 # On 10.6, killall has a new constraint: -SIGNALNAME or | 101 # On 10.6, killall has a new constraint: -SIGNALNAME or |
102 # -SIGNALNUMBER must come first. Example problem: | 102 # -SIGNALNUMBER must come first. Example problem: |
103 # $ killall -u $USER -TERM lighttpd | 103 # $ killall -u $USER -TERM lighttpd |
104 # killall: illegal option -- T | 104 # killall: illegal option -- T |
105 # Use of the earlier -TERM placement is just fine on 10.5. | 105 # Use of the earlier -TERM placement is just fine on 10.5. |
106 subprocess.call(['killall', '-TERM', '-u', os.getenv('USER'), 'lighttpd']) | 106 subprocess.call(['killall', '-TERM', '-u', os.getenv('USER'), 'lighttpd']) |
| 107 subprocess.call(['killall', '-TERM', '-u', os.getenv('USER'), 'httpd']) |
107 else: | 108 else: |
108 os.kill(server_process.pid, signal.SIGTERM) | 109 os.kill(server_process.pid, signal.SIGTERM) |
109 | 110 |
110 def KillProcess(pid): | 111 def KillProcess(pid): |
111 """Forcefully kill the process. | 112 """Forcefully kill the process. |
112 | 113 |
113 Args: | 114 Args: |
114 pid: The id of the process to be killed. | 115 pid: The id of the process to be killed. |
115 """ | 116 """ |
116 os.kill(pid, signal.SIGKILL) | 117 os.kill(pid, signal.SIGKILL) |
117 | 118 |
118 def KillAllTestShells(): | 119 def KillAllTestShells(): |
119 """Kills all instances of the test_shell binary currently running.""" | 120 """Kills all instances of the test_shell binary currently running.""" |
120 subprocess.Popen(('killall', '-TERM', 'test_shell'), | 121 subprocess.Popen(('killall', '-TERM', 'test_shell'), |
121 stdout=subprocess.PIPE, | 122 stdout=subprocess.PIPE, |
122 stderr=subprocess.PIPE).wait() | 123 stderr=subprocess.PIPE).wait() |
OLD | NEW |