| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 def ShutDownHTTPServer(server_process): | 90 def ShutDownHTTPServer(server_process): |
| 91 """Shut down the lighttpd web server. Blocks until it's fully shut down. | 91 """Shut down the lighttpd web server. Blocks until it's fully shut down. |
| 92 | 92 |
| 93 Args: | 93 Args: |
| 94 server_process: The subprocess object representing the running server | 94 server_process: The subprocess object representing the running server |
| 95 """ | 95 """ |
| 96 # server_process is not set when "http_server.py stop" is run manually. | 96 # server_process is not set when "http_server.py stop" is run manually. |
| 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 subprocess.call(['killall', '-u', os.getenv('USER'), '-TERM', 'lighttpd']) | 100 |
| 101 # On 10.6, killall has a new constraint: -SIGNALNAME or |
| 102 # -SIGNALNUMBER must come first. Example problem: |
| 103 # $ killall -u $USER -TERM lighttpd |
| 104 # killall: illegal option -- T |
| 105 # Use of the earlier -TERM placement is just fine on 10.5. |
| 106 subprocess.call(['killall', '-TERM', '-u', os.getenv('USER'), 'lighttpd']) |
| 101 else: | 107 else: |
| 102 os.kill(server_process.pid, signal.SIGTERM) | 108 os.kill(server_process.pid, signal.SIGTERM) |
| 103 | 109 |
| 104 def KillAllTestShells(): | 110 def KillAllTestShells(): |
| 105 """Kills all instances of the test_shell binary currently running.""" | 111 """Kills all instances of the test_shell binary currently running.""" |
| 106 subprocess.Popen(('killall', '-TERM', 'test_shell'), | 112 subprocess.Popen(('killall', '-TERM', 'test_shell'), |
| 107 stdout=subprocess.PIPE, | 113 stdout=subprocess.PIPE, |
| 108 stderr=subprocess.PIPE).wait() | 114 stderr=subprocess.PIPE).wait() |
| 109 | |
| OLD | NEW |