OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2016 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2016 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 errno | 7 import errno |
8 import os | 8 import os |
9 import signal | 9 import signal |
10 import subprocess | 10 import subprocess |
11 import sys | 11 import sys |
12 | 12 |
13 from slave import goma_utils | 13 from slave import goma_utils |
14 | 14 |
15 | 15 |
16 def start_cloudtail(args): | 16 def start_cloudtail(args): |
17 """Write process id of started cloudtail to file object f""" | 17 """Write process id of started cloudtail to file object f""" |
18 | 18 |
19 proc = subprocess.Popen([args.cloudtail_path, | 19 proc = subprocess.Popen([args.cloudtail_path, |
20 'tail', | 20 'tail', |
21 '--log-id', 'goma_compiler_proxy', | 21 '--log-id', 'goma_compiler_proxy', |
22 '--path', | 22 '--path', |
23 goma_utils.GetLatestGomaCompilerProxyInfo()]) | 23 goma_utils.GetLatestGomaCompilerProxyInfo()], |
| 24 stdout=open(os.devnull, 'w'), |
| 25 stderr=open(os.devnull, 'w'), |
| 26 close_fds=True) |
24 | 27 |
25 sys.stdout.write(str(proc.pid)) | 28 sys.stdout.write(str(proc.pid)) |
26 | 29 |
27 | 30 |
28 def main(): | 31 def main(): |
29 parser = argparse.ArgumentParser( | 32 parser = argparse.ArgumentParser( |
30 description='cloudtail utility for goma recipe module.') | 33 description='cloudtail utility for goma recipe module.') |
31 | 34 |
32 subparsers = parser.add_subparsers(help='commands for cloudtail') | 35 subparsers = parser.add_subparsers(help='commands for cloudtail') |
33 | 36 |
(...skipping 17 matching lines...) Expand all Loading... |
51 try: | 54 try: |
52 os.kill(args.killed_pid, signal.SIGKILL) | 55 os.kill(args.killed_pid, signal.SIGKILL) |
53 except OSError as e: | 56 except OSError as e: |
54 if e.errno != errno.ESRCH: | 57 if e.errno != errno.ESRCH: |
55 # TODO(tikuta): Resolve https://crbug.com/639910. | 58 # TODO(tikuta): Resolve https://crbug.com/639910. |
56 raise | 59 raise |
57 | 60 |
58 | 61 |
59 if '__main__' == __name__: | 62 if '__main__' == __name__: |
60 sys.exit(main()) | 63 sys.exit(main()) |
OLD | NEW |