[xmonad] Why do we close stdin in (some) spawned processes?

ivan ivan.brennan at gmail.com
Tue Jan 12 22:06:25 UTC 2021


Actually, I misspoke (and so did the commit message) -- we aren't closing
stdin, but rather redirecting it to /dev/null.

On Tue, Jan 12, 2021 at 10:13 AM Brandon Allbery <allbery.b at gmail.com>
wrote:

> Probably we should not be closing it; or at least should have it open on
> /dev/null. There is a general expectation in the POSIX model that fds 0, 1,
> 2 are open.
>
> On Tue, Jan 12, 2021, 10:06 ivan <ivan.brennan at gmail.com> wrote:
>
>> In 'spawn', we close stdin in the child process, whereas in 'safeSpawn'
>> from xmonad-contrib we do not. I'm curious why that's the case?
>>
>> This commit introduced the code that closes stdin, but doesn't describe
>> the motivation for doing so:
>>
>> https://github.com/xmonad/xmonad/commit/353e7cd6811245fbee7c8c6cf821041c924523b3
>>
>> I suspect we close stdin in 'spawn' because we know it won't be needed,
>> but I'm still not sure what we gain by closing it (does it improve
>> efficiency?). And should we be closing it in 'safeSpawn' as well, or does
>> 'safeSpawn' have a use-case that requires reading from stdin?
>> _______________________________________________
>> xmonad mailing list
>> xmonad at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/xmonad/attachments/20210112/533d9977/attachment.html>


More information about the xmonad mailing list