Re: subprocess vs. proctools

2004-12-15 Thread Keith Dart
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

Re: subprocess vs. proctools

2004-12-15 Thread Nick Craig-Wood
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

Re: subprocess vs. proctools

2004-12-14 Thread Keith Dart
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

Re: subprocess vs. proctools

2004-12-14 Thread Donn Cave
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

Re: subprocess vs. proctools

2004-12-13 Thread Keith Dart
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