Skip Menu |

This queue is for tickets about the Getopt-Euclid CPAN distribution.

Report information
The Basics
Id: 26206
Status: resolved
Priority: 0/
Queue: Getopt-Euclid

People
Owner: Nobody in particular
Requestors: Toby.Allsopp [...] navman.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Should exit with non-zero status on errors
Date: Tue, 10 Apr 2007 11:26:11 +1200
To: bug-getopt-euclid [...] rt.cpan.org
From: Toby Allsopp <Toby.Allsopp [...] navman.com>
If an error occurs when parsing the command line, e.g. an unknown option or a missing required one, the program should exit with a non-zero status so that the invoking process knows that something has gone wrong. It is traditional to use an exit status of 2 for this case. It is also traditional to use an exit status of 1 when only usage information has been displayed (e.g. in response to --help, --usage or --version) so that it is clear that no useful work has been done. See the DESCRIPTION section of Pod::Usage for corroboration.
Subject: Re: [rt.cpan.org #26206] Should exit with non-zero status on errors
Date: Wed, 11 Apr 2007 14:46:02 +1000
To: bug-Getopt-Euclid [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Toby Allsopp via RT wrote: Show quoted text
> If an error occurs when parsing the command line, e.g. an unknown > option or a missing required one, the program should exit with a > non-zero status so that the invoking process knows that something has > gone wrong. It is traditional to use an exit status of 2 for this > case.
Fixed in the next release. Thanks! Show quoted text
> It is also traditional to use an exit status of 1 when only usage > information has been displayed (e.g. in response to --help, --usage or > --version) so that it is clear that no useful work has been done.
Hmmmm. I'm not certain how widespread that tradition actually is. A quick survey of some common Unix utilities shows that most of them (under Darwin BSD at least) exit with zero when explicitly asked for usage info. Besides, I'm not sure it's logical to return a failure value when the app has successfully done exactly what was asked. Can you point me at any Unix reference that mentions this particular tradition? Damian
Subject: Re: [rt.cpan.org #26206] Should exit with non-zero status on errors
Date: Thu, 12 Apr 2007 07:23:38 +1200
To: "bug-Getopt-Euclid\ [...] rt.cpan.org" <bug-Getopt-Euclid [...] rt.cpan.org>
From: Toby Allsopp <Toby.Allsopp [...] navman.com>
On 11 Apr 2007 at 16:46 NZST, bug-Getopt-Euclid@rt.cpan.org wrote: Show quoted text
> Toby Allsopp via RT wrote:
[...] Show quoted text
>> It is also traditional to use an exit status of 1 when only usage >> information has been displayed (e.g. in response to --help, --usage >> or --version) so that it is clear that no useful work has been >> done.
> > Hmmmm. I'm not certain how widespread that tradition actually is. A > quick survey of some common Unix utilities shows that most of them > (under Darwin BSD at least) exit with zero when explicitly asked for > usage info. Besides, I'm not sure it's logical to return a failure > value when the app has successfully done exactly what was asked. Can > you point me at any Unix reference that mentions this particular > tradition?
No, I can't and I agree that it doesn't seem very common. I'm quite happy for the exit status to remain zero when usage was requested. Thanks, Toby.
Damian resolved this in version 0.2.0