From cc57b81bbcb7455f32ab42926082f1347f7c51a9 Mon Sep 17 00:00:00 2001 From: Richard Ipsum Date: Fri, 7 Aug 2015 09:06:22 +0100 Subject: 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 --- morphlib/builder.py | 16 +++++++++------- 1 file 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() -- cgit v1.2.1