exit status

David Goodger <[email protected]> Thu, 12 Jun 2003 16:48:53 -0400
Newsgroups gmane.comp.python.optik.user
Message-ID <[email protected]>
Shouldn't optik/optparse produce an exit status of 2 in
OptionParser.error?  It's currently producing exit status 1.  From the
"sys" module docs,

     exit([arg])
         Exit from Python. ... The optional argument arg can be an
         integer giving the exit status ... Unix programs generally use
         2 for command line syntax errors and 1 for all other kind of
         errors.

The change is simple.  Replace the old line:

         sys.exit("%s: error: %s" % (get_prog_name(), msg))

with these:

         print >>sys.stderr, "%s: error: %s" % (get_prog_name(), msg)
         sys.exit(2)

-- David Goodger



-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5