summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeppo Yli-Olli <seppo.yliolli@gmail.com>2020-12-03 21:15:29 +0200
committerSeppo Yli-Olli <seppo.yliolli@gmail.com>2020-12-03 21:52:04 +0200
commit7dc409c3be5037d7ff024a12539ca86f8a9d0653 (patch)
tree88a65f68b22f458d723dbf74e1559cba89eafea4
parentf971c6e63faf3cb2a382d3f563a475a45e77d0bb (diff)
downloadbuildstream-nanonyme/subprocess-devnull.tar.gz
Stop repeatedly re-opening /dev/nullnanonyme/subprocess-devnull
-rw-r--r--buildstream/plugin.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/buildstream/plugin.py b/buildstream/plugin.py
index f2785349f..cc7788c91 100644
--- a/buildstream/plugin.py
+++ b/buildstream/plugin.py
@@ -729,8 +729,7 @@ class Plugin():
def _output_file(self):
log = self.__context.get_log_handle()
if log is None:
- with open(os.devnull, "w") as output:
- yield output
+ yield subprocess.DEVNULL
else:
yield log
@@ -806,8 +805,9 @@ class Plugin():
if 'cwd' in kwargs:
workdir = kwargs['cwd']
command = " ".join(popenargs[0])
- output.write('Running host command {}: {}\n'.format(workdir, command))
- output.flush()
+ if output is not subprocess.DEVNULL:
+ output.write('Running host command {}: {}\n'.format(workdir, command))
+ output.flush()
self.status('Running host command', detail=command)
def _get_full_name(self):