projects
/
mdk.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
682729f
)
Subprocesses are killed when CTRL + C
author
Frederic Massart
<fred@moodle.com>
Mon, 7 Apr 2014 04:55:30 +0000
(12:55 +0800)
committer
Frederic Massart
<fred@moodle.com>
Mon, 7 Apr 2014 04:55:30 +0000
(12:55 +0800)
lib/tools.py
patch
|
blob
|
history
diff --git
a/lib/tools.py
b/lib/tools.py
index
2d25845
..
264cba3
100644
(file)
--- a/
lib/tools.py
+++ b/
lib/tools.py
@@
-130,8
+130,12
@@
def process(cmd, cwd=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE):
if type(cmd) != list:
cmd = shlex.split(str(cmd))
logging.debug(' '.join(cmd))
- proc = subprocess.Popen(cmd, cwd=cwd, stdout=stdout, stderr=stderr)
- (out, err) = proc.communicate()
+ try:
+ proc = subprocess.Popen(cmd, cwd=cwd, stdout=stdout, stderr=stderr)
+ (out, err) = proc.communicate()
+ except KeyboardInterrupt as e:
+ proc.kill()
+ raise e
return (proc.returncode, out, err)