AbstractEbuildProcess: null in if not interactive
authorZac Medico <zmedico@gentoo.org>
Tue, 13 Dec 2011 17:27:38 +0000 (09:27 -0800)
committerZac Medico <zmedico@gentoo.org>
Tue, 13 Dec 2011 17:27:38 +0000 (09:27 -0800)
pym/_emerge/AbstractEbuildProcess.py

index 4147ecb7b2cb306aa312c31f5e77b3f15c6ee837..6e1491bbe3a7c4fcf8b1cc05de7423e19f02b2f1 100644 (file)
@@ -92,7 +92,19 @@ class AbstractEbuildProcess(SpawnProcess):
                        else:
                                self.settings.pop('PORTAGE_EBUILD_EXIT_FILE', None)
 
-               SpawnProcess._start(self)
+               if self.fd_pipes is None:
+                       self.fd_pipes = {}
+               null_fd = None
+               if 0 not in self.fd_pipes and \
+                       "interactive" not in self.settings.get("PROPERTIES", "").split():
+                       null_fd = os.open('/dev/null', os.O_RDONLY)
+                       self.fd_pipes[0] = null_fd
+
+               try:
+                       SpawnProcess._start(self)
+               finally:
+                       if null_fd is not None:
+                               os.close(null_fd)
 
        def _init_ipc_fifos(self):