Re: [PATCH] Clean up file descriptors when calling hooks.
- From
Daniel Barkalow <barkalow@iabervon.org>
- Date
- Dec 8, 2005, 05:33 UTC
- Message-ID
- <Pine.LNX.4.64.0512080006460.25300@iabervon.org>
- In-Reply-To
- <7vvey0mik7.fsf@assigned-by-dhcp.cox.net>
On Wed, 7 Dec 2005, Junio C Hamano wrote:
Show 8 quoted lines
> Daniel Barkalow <barkalow@iabervon.org> writes: > > > When calling post-update hook, don't leave stdin and stdout connected to > > the pushing connection. > > A quick question. I understand "not connected to the pushing > connection" is desirable, but is there a reason you chose to > leave them open to /dev/null, not close()d?
Wouldn't that make programs that assume that stdout (or stdin) is still valid get errors? I particularly want git-merge (which has a habit of saying "Already up-to-date. Yeeah!") to work. Also, something that assumes that fd 1 is somewhere to report stuff will get into trouble if it opens a couple of files for writing and fd 0/1 weren't open before. I seem to recall the standard thing for running with no I/O to be to use /dev/null (e.g., daemon(), if you don't keep your fds, replaces them with /dev/null).
-Daniel *This .sig left intentionally blank*