You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by gi...@apache.org on 2020/12/29 13:06:09 UTC

[buildstream] branch nanonyme/subprocess-devnull created (now 7dc409c)

This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a change to branch nanonyme/subprocess-devnull
in repository https://gitbox.apache.org/repos/asf/buildstream.git.


      at 7dc409c  Stop repeatedly re-opening /dev/null

This branch includes the following new commits:

     new 7dc409c  Stop repeatedly re-opening /dev/null

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[buildstream] 01/01: Stop repeatedly re-opening /dev/null

Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch nanonyme/subprocess-devnull
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 7dc409c3be5037d7ff024a12539ca86f8a9d0653
Author: Seppo Yli-Olli <se...@gmail.com>
AuthorDate: Thu Dec 3 21:15:29 2020 +0200

    Stop repeatedly re-opening /dev/null
---
 buildstream/plugin.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/buildstream/plugin.py b/buildstream/plugin.py
index f278534..cc7788c 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):