Am Mon, 11 Mar 2013 06:32:42 +0100 schrieb "Vladimir Panteleev" <[email protected]>:
> On Monday, 11 March 2013 at 05:24:49 UTC, Marco Leise wrote: > > > > Python: > > > >> def _mkstemp_inner(dir, pre, suf, flags): > >> """Code common to mkstemp, TemporaryFile, and > >> NamedTemporaryFile.""" > > So it only sets the flag on temporary files? It's the only place where I could quickly identify it with a grep. Even for Python 3.4 this is still an open issue it seems, like this bug report shows: http://bugs.python.org/issue12107 It also discusses pros and cons a bit. > > I think they just rely on the C library at the moment for their > > System.IO, > > which in turn doesn't set FD_CLOEXEC. > > > Rust: > > > > Uses C stdlib. > > Is there any discussion on why libc doesn't do it, and what do > APIs that wrap the C API do? I haven't researched any of that so far. All I know is that glibc added a new flag with 2.7 for that: > e (since glibc 2.7) > Open the file with the O_CLOEXEC flag. See open(2) for more > information. This flag is ignored for fdopen(). > > Despite the increased maintenance cost I think we should adapt > > that behavoir in D as well. > > I don't think there would be a maintenance cost to speak of. > Wouldn't it be a one-line addition to a few places? More or less. You have to query the flags, add FD_CLOEXEC and set them again. Error handling wouldn't be bad either. Its enough to write a helper function for that. -- Marco
