[Haskell-cafe] Re: ANNOUNCE: New versions of ALL the monadic
regions packages
Brandon S. Allbery KF8NH
allbery at ece.cmu.edu
Fri Jan 8 00:03:51 EST 2010
On Jan 7, 2010, at 14:44 , Bas van Dijk wrote:
> On Thu, Jan 7, 2010 at 5:18 PM, Bulat Ziganshin
> <bulat.ziganshin at gmail.com> wrote:
>> Thursday, January 7, 2010, 6:25:34 PM, you wrote:
>>> So now I'm confused... are these standard file handles always open
>>> on
>>> program startup or are there abnormal situations when they are
>>> closed?
>>
>> afaik, parent process may close them before executing your program,
>> it's used in particular for running daemons
>
> Thanks Bulat for explaining.
POSIX actually discourages that, because it's so common for library
routines to assume they can write error messages to stderr; the
approved way to handle daemons is to open the standard file handles
on /dev/null, *not* to close them. There are systems that violate
this, however (the most "fun" one I've encountered is Applications
menu commands in Mac OS X 10.4's X11.app; bash partially works around
it, but not entirely).
So the correct thing to do is to check if they are open on startup,
and if not open /dev/null.
--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university KF8NH
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100107/bd4e7cf6/PGP.bin
More information about the Haskell-Cafe
mailing list