summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2015-08-07 09:06:22 +0100
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2015-08-07 09:59:20 +0000
commitcc57b81bbcb7455f32ab42926082f1347f7c51a9 (patch)
treec8d8ac309b424deab198f9edcff6fa028069a954
parent98271fdc0ca865f26f71ea0408492f07a193c9c6 (diff)
downloadmorph-cc57b81bbcb7455f32ab42926082f1347f7c51a9.tar.gz
Set chunk commands' stdin to /dev/null
Chunk commands will currently block if they read from stdin. To fix this we set stdin to /dev/null so that the first read returns EOF. Change-Id: I143396f4c443c098b2880c5925e6f0907cb4fb17
-rw-r--r--morphlib/builder.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/morphlib/builder.py b/morphlib/builder.py
index 1eb0201c..826bd42f 100644
--- a/morphlib/builder.py
+++ b/morphlib/builder.py
@@ -373,13 +373,15 @@ class ChunkBuilder(BuilderBase):
if stdout:
stdout.flush()
- self.runcmd(['sh', '-c', cmd],
- extra_env=extra_env,
- cwd=relative_builddir,
- stdout=stdout or subprocess.PIPE,
- stderr=subprocess.STDOUT,
- logfile=logfilepath,
- ccache_dir=ccache_dir)
+ with open(os.devnull) as devnull:
+ self.runcmd(['sh', '-c', cmd],
+ extra_env=extra_env,
+ cwd=relative_builddir,
+ stdin=devnull,
+ stdout=stdout or subprocess.PIPE,
+ stderr=subprocess.STDOUT,
+ logfile=logfilepath,
+ ccache_dir=ccache_dir)
if stdout:
stdout.flush()