Gentoo Archives: gentoo-portage-dev

From: Brian Harring <ferringb@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [3/7] portage_exec cleanups
Date: Sat, 29 Oct 2005 15:18:26
Message-Id: 20051029151722.GN24883@nightcrawler
In Reply to: Re: [gentoo-portage-dev] [3/7] portage_exec cleanups by Jason Stubbs
1 On Sun, Oct 30, 2005 at 12:06:10AM +0900, Jason Stubbs wrote:
2 > + my_pipes = {}
3 > + close_pipes = {}
4 > + for x in fd_pipes:
5 > + my_pipes[x] = os.dup(fd_pipes[x])
6 > + close_pipes[fd_pipes[x]] = True
7 > + for x in close_pipes:
8 > + os.close(x)
9 > + for x in my_pipes:
10 > + os.dup2(my_pipes[x], x)
11 > + os.close(my_pipes[x])
12
13 Works for me- might be worth tracking what was closed to avoid trying
14 to close those fd's during the "force all unused fd's closed" run,
15 from a speed standpoint (less syscalls).
16 ~harring