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

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

Issue 1860863002: Update copyright notice from Swarming to LUCI; add AUTHORS and CONTRIBUTORS. (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: . Created 4 years, 8 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 Swarming Authors. All rights reserved. 1 # Copyright 2013 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 that 2 # Use of this source code is governed by the Apache v2.0 license that can be
3 # can be found in the LICENSE file. 3 # 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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 """Runs an executable; kill it in case of timeout.""" 582 """Runs an executable; kill it in case of timeout."""
583 proc = Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, **kwargs) 583 proc = Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, **kwargs)
584 try: 584 try:
585 out, err = proc.communicate(timeout=timeout) 585 out, err = proc.communicate(timeout=timeout)
586 except TimeoutExpired as e: 586 except TimeoutExpired as e:
587 out = e.output 587 out = e.output
588 err = e.stderr 588 err = e.stderr
589 proc.kill() 589 proc.kill()
590 proc.wait() 590 proc.wait()
591 return out, err, proc.returncode, proc.duration() 591 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