[Haskell-cafe] Strange behavior of executeFile
Krzysztof Kościuszkiewicz
k.kosciuszkiewicz at gmail.com
Sun Jul 29 14:41:40 EDT 2007
On Sun, Jul 29, 2007 at 10:34:10AM -0700, Bryan O'Sullivan wrote:
> GHC's file handles are backed by non-blocking file descriptors. The
> child process run by executeFile inherits the stdin, stdout and stderr
> file descriptors of your Haskell process, so they're unexpectedly (from
> its perspective) in non-blocking mode.
>
> Due to POSIX sharing semantics, you can't simply switch those file
> descriptors to blocking in the child, because they'll then become
> blocking in the parent, too.
Yes, this would explain the behavior I'm seeing. My script neither forks
nor reads stdin, so I could hack around this problem by clearing the
O_NONBLOCK flag:
> setFdOption stdInput NonBlockingRead False
Thanks for your help!
Regards,
--
Krzysztof Kościuszkiewicz
Skype: dr.vee, Gadu: 111851, Jabber: kokr at jabberpl.org
Mobile IRL: +353851383329, Mobile PL: +48783303040
"Simplicity is the ultimate sophistication" -- Leonardo da Vinci
More information about the Haskell-Cafe
mailing list