| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2015 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 import argparse | 6 import argparse |
| 7 import logging | 7 import logging |
| 8 import signal | 8 import signal |
| 9 import socket | 9 import socket |
| 10 import sys | 10 import sys |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 def sigint_handler(_signal, _frame): | 68 def sigint_handler(_signal, _frame): |
| 69 watcher.stop() | 69 watcher.stop() |
| 70 | 70 |
| 71 try: | 71 try: |
| 72 with daemon.flock('service_manager.flock', opts.state_directory): | 72 with daemon.flock('service_manager.flock', opts.state_directory): |
| 73 previous_sigint_handler = signal.signal(signal.SIGINT, sigint_handler) | 73 previous_sigint_handler = signal.signal(signal.SIGINT, sigint_handler) |
| 74 watcher.run() | 74 watcher.run() |
| 75 signal.signal(signal.SIGINT, previous_sigint_handler) | 75 signal.signal(signal.SIGINT, previous_sigint_handler) |
| 76 except daemon.LockAlreadyLocked: | 76 except daemon.LockAlreadyLocked: |
| 77 logging.error('Another instance of service_manager is already running') | 77 # Another instance is already running. |
| 78 return 1 | 78 return 1 |
| 79 else: | 79 else: |
| 80 ts_mon.close() | 80 ts_mon.close() |
| 81 | 81 |
| 82 return 0 | 82 return 0 |
| 83 | 83 |
| 84 | 84 |
| 85 if __name__ == '__main__': | 85 if __name__ == '__main__': |
| 86 sys.exit(main(sys.argv[1:])) | 86 sys.exit(main(sys.argv[1:])) |
| 87 | 87 |
| OLD | NEW |