EbuildMetadataPhase: use /dev/null for stdin
authorZac Medico <zmedico@gentoo.org>
Sat, 29 Oct 2011 21:41:38 +0000 (14:41 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 29 Oct 2011 21:41:38 +0000 (14:41 -0700)
pym/_emerge/EbuildMetadataPhase.py
pym/_emerge/actions.py

index bf562c56840d0610a5b0437a915de6fdc29faa03..16948df76062ee9fd31cb6b3dda7a96bf35d8d15 100644 (file)
@@ -63,7 +63,8 @@ class EbuildMetadataPhase(SubProcess):
                else:
                        fd_pipes = {}
 
-               fd_pipes.setdefault(0, sys.stdin.fileno())
+               null_input = open('/dev/null', 'rb')
+               fd_pipes.setdefault(0, null_input.fileno())
                fd_pipes.setdefault(1, sys.stdout.fileno())
                fd_pipes.setdefault(2, sys.stderr.fileno())
 
@@ -96,6 +97,7 @@ class EbuildMetadataPhase(SubProcess):
                        fd_pipes=fd_pipes, returnpid=True)
 
                os.close(slave_fd)
+               null_input.close()
 
                if isinstance(retval, int):
                        # doebuild failed before spawning
index 28fe549e82ee10f539b022837110d865e53b4dcf..036b471a143d9b4ef5b4267573f794f2043902ce 100644 (file)
@@ -1864,12 +1864,6 @@ def action_regen(settings, portdb, max_jobs, max_load):
        xterm_titles = "notitles" not in settings.features
        emergelog(xterm_titles, " === regen")
        #regenerate cache entries
-       try:
-               os.close(sys.stdin.fileno())
-       except SystemExit:
-               raise # Needed else can't exit
-       except:
-               pass
        sys.stdout.flush()
 
        regen = MetadataRegen(portdb, max_jobs=max_jobs, max_load=max_load)