Nick Craig-Wood wrote:
There are many ways for a program to fail (non-zero exit codes) but
only one way for it to succeed (zero exit code). Therefore rc should
be 0 for success.
Exactly. And as a convenience the ExitStatus object of proctools handles
that for you.
As a general rule, I believe Py
Keith Dart <[EMAIL PROTECTED]> wrote:
> Nick Craig-Wood wrote:
> > This sounds rather like the new subprocess module...
> >
> import subprocess
> rc = subprocess.call(["ls", "-l"])
> >
> > total 381896
> > -rw-r--r--1 ncw ncw 1542 Oct 12 17:55 1
> > [snip]
> > -rw-r--r--1 nc
Donn Cave wrote:
Keith Dart <[EMAIL PROTECTED]> wrote:
|>> if exitstatus:
|>> print "good result (errorlevel of zero)"
|>> else:
|>> print exitstatus # prints message with exit value
This is indeed how the shell works, though the actual failure value
is rarely of any interest. It's also
Keith Dart <[EMAIL PROTECTED]> wrote:
|>> Oh, I forgot to mention that it also has a more user- and
|>> programmer-friendly ExitStatus object that processess can return. This
|>> is directly testable in Python:
|>>
|>> proc = proctools.spawn("somecommand")
|>> exitstatus = proc.wait()
|>>
|>> if
Nick Craig-Wood wrote:
Keith Dart <[EMAIL PROTECTED]> wrote:
Oh, I forgot to mention that it also has a more user- and
programmer-friendly ExitStatus object that processess can return. This
is directly testable in Python:
proc = proctools.spawn("somecommand")
exitstatus = proc.wait()
if exitstat