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'), | |
shinyak
2016/09/29 05:00:16
It looks cloudtail emits error to stderr :-(
Is it
| |
26 close_fds=True) | 24 close_fds=True) |
ukai
2016/09/29 04:51:45
might be better to leave stdout, stderr and drop c
tikuta
2016/09/29 05:00:28
raw_io opens fds in goma module.
so, I need to clo
| |
27 | 25 |
28 sys.stdout.write(str(proc.pid)) | 26 sys.stdout.write(str(proc.pid)) |
29 | 27 |
30 | 28 |
31 def main(): | 29 def main(): |
32 parser = argparse.ArgumentParser( | 30 parser = argparse.ArgumentParser( |
33 description='cloudtail utility for goma recipe module.') | 31 description='cloudtail utility for goma recipe module.') |
34 | 32 |
35 subparsers = parser.add_subparsers(help='commands for cloudtail') | 33 subparsers = parser.add_subparsers(help='commands for cloudtail') |
36 | 34 |
(...skipping 17 matching lines...) Expand all Loading... | |
54 try: | 52 try: |
55 os.kill(args.killed_pid, signal.SIGKILL) | 53 os.kill(args.killed_pid, signal.SIGKILL) |
56 except OSError as e: | 54 except OSError as e: |
57 if e.errno != errno.ESRCH: | 55 if e.errno != errno.ESRCH: |
58 # TODO(tikuta): Resolve https://crbug.com/639910. | 56 # TODO(tikuta): Resolve https://crbug.com/639910. |
59 raise | 57 raise |
60 | 58 |
61 | 59 |
62 if '__main__' == __name__: | 60 if '__main__' == __name__: |
63 sys.exit(main()) | 61 sys.exit(main()) |
OLD | NEW |