Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: scripts/slave/recipe_modules/goma/resources/cloudtail_utils.py

Issue 2374543005: Set close_fds True in Popen of cloudtail (Closed)
Patch Set: use devnull for stdout/stderr of cloudtail Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698