Hi,

ri...@happyleptic.org skribis:

> -[ Tue, Aug 30, 2011 at 05:55:22PM +0200, Ludovic Courtès ]----
>> Like in C, it???s up to the application to close those ports that it
>> considers worth closing upon exec.

[...]

> OK then, so it's not a bug and I have to live with this behavior
> (BTW, if anyone knows the rational behind this, I would be glad to
> know).

When typing “foo 2< baz 5> bar” in a shell, the shell first forks, the
opens/dups 2 and 5, and finally execs ‘foo’, which gets to see 2 and 5
as open FDs.  Same for pipes.

> Except that, as previously discussed in another thread, there is no easy
> way to do that between the fork and the exec (since I don't want to
> actually close these files in the main program that starts the pipe).

Hmm right.  We’d need to insert a hook in ‘open-pipe’ so that, when this
behavior is wanted, one can actually close those FDs.

Ideas?

Thanks,
Ludo’.


Reply via email to