When we launch subprocesses we should make sure they're using the
standard SIGPIPE handler, instead of the custom handling that python
uses so that it can translate them into exceptions.
Risk: Medium
Visibility: system() and run() calls that uses pipes should stop
hanging.
Signed-off-by: John Admanski <jadmanski@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@1754 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/common_lib/utils.py b/client/common_lib/utils.py
index 5d6a54e..0d6d109 100644
--- a/client/common_lib/utils.py
+++ b/client/common_lib/utils.py
@@ -195,8 +195,10 @@
def run_bg(command):
"""Run the command in a subprocess and return the subprocess."""
result = CmdResult(command)
+ def reset_sigpipe():
+ signal.signal(signal.SIGPIPE, signal.SIG_DFL)
sp = subprocess.Popen(command, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
+ stderr=subprocess.PIPE, preexec_fn=reset_sigpipe,
shell=True, executable="/bin/bash")
return sp, result