Error Handling (was Re: Keeping an eye on hung system calls..)

Lusercop `the.lusercop' at
Wed Jun 7 09:48:13 BST 2006

On Tue, Jun 06, 2006 at 02:43:42PM +0100, Thomas Yandell wrote:
> Lusercop wrote:
> > On Tue, Jun 06, 2006 at 12:59:05PM +0100, Thomas Yandell wrote:
> >> if (my $child = fork) {
> >> else {
> > Where's the "fork() failed" error handling?
> > Grr.
> My bad:
> my $child = fork;
> die "could not fork" unless defined $child;
> if ($child) {
> ...

Sorry about the first message, but this is a pet beef of mine. System calls
can (and do) fail, and you should know what the reasons are for them doing
so. Handling the situation properly isn't always a case of "die() on any

Traditionally, in a unix program, you would have something like:
| progname: fork: Cannot allocate memory.
as the die message. To me, this is lovely, concise, to the point, and with
all the relevant information in it.

-- - LARTing Lusers everywhere since 2002

More information about the mailing list