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

Side by Side Diff: client/utils/subprocess42.py

Issue 2013943002: Changing license header, again! (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: Fixed third parties Created 4 years, 7 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 | « client/utils/on_error.py ('k') | client/utils/threading_utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The LUCI Authors. All rights reserved. 1 # Copyright 2013 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 under the Apache License, Version 2.0
3 # found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 """subprocess42 is the answer to life the universe and everything. 5 """subprocess42 is the answer to life the universe and everything.
6 6
7 It has the particularity of having a Popen implementation that can yield output 7 It has the particularity of having a Popen implementation that can yield output
8 as it is produced while implementing a timeout and NOT requiring the use of 8 as it is produced while implementing a timeout and NOT requiring the use of
9 worker threads. 9 worker threads.
10 10
11 Example: 11 Example:
12 Wait for a child process with a timeout, send SIGTERM, wait a grace period 12 Wait for a child process with a timeout, send SIGTERM, wait a grace period
13 then send SIGKILL: 13 then send SIGKILL:
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 """Runs an executable; kill it in case of timeout.""" 594 """Runs an executable; kill it in case of timeout."""
595 proc = Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, **kwargs) 595 proc = Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, **kwargs)
596 try: 596 try:
597 out, err = proc.communicate(timeout=timeout) 597 out, err = proc.communicate(timeout=timeout)
598 except TimeoutExpired as e: 598 except TimeoutExpired as e:
599 out = e.output 599 out = e.output
600 err = e.stderr 600 err = e.stderr
601 proc.kill() 601 proc.kill()
602 proc.wait() 602 proc.wait()
603 return out, err, proc.returncode, proc.duration() 603 return out, err, proc.returncode, proc.duration()
OLDNEW
« no previous file with comments | « client/utils/on_error.py ('k') | client/utils/threading_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698