OLD | NEW |
1 # Copyright 2015 The Swarming Authors. All rights reserved. | 1 # Copyright 2015 The LUCI Authors. All rights reserved. |
2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed by the Apache v2.0 license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Utilities.""" | 5 """Utilities.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import signal | 9 import signal |
10 import sys | 10 import sys |
11 | 11 |
(...skipping 24 matching lines...) Expand all Loading... |
36 proc.send_signal(signal.SIGTERM) | 36 proc.send_signal(signal.SIGTERM) |
37 | 37 |
38 sig = signal.SIGBREAK if sys.platform == 'win32' else signal.SIGTERM | 38 sig = signal.SIGBREAK if sys.platform == 'win32' else signal.SIGTERM |
39 with subprocess42.set_signal_handler([sig], handler): | 39 with subprocess42.set_signal_handler([sig], handler): |
40 proc.wait() | 40 proc.wait() |
41 return proc.returncode | 41 return proc.returncode |
42 except Exception as e: | 42 except Exception as e: |
43 logging.exception('failed to start: %s', e) | 43 logging.exception('failed to start: %s', e) |
44 # Swallow the exception. | 44 # Swallow the exception. |
45 return 1 | 45 return 1 |
OLD | NEW |