Permalink
Browse files

start() now returns the process' exitcode.

  • Loading branch information...
1 parent d5d8a48 commit ec283812876e6e6bba5384ee15c7aa64df79dd3a @nvie committed May 19, 2010
Showing with 8 additions and 2 deletions.
  1. +5 −1 drainers/drainer.py
  2. +3 −1 examples/example.py
View
@@ -111,6 +111,8 @@ def start(self):
Note that `start()` blocks until the process is finished.
+ Returns the exitcode of the process.
+
'''
self._popen_kwargs['stdout'] = subprocess.PIPE
self._popen_kwargs['stderr'] = subprocess.PIPE
@@ -146,8 +148,10 @@ def start(self):
# in case wait() finishes before force_kill_timeout elapsed, we
# may simply cancel the force_kill timer
- self.process.wait()
+ exitcode = self.process.wait()
if self.force_kill_timeout is not None:
kill_timer.cancel()
+ return exitcode
+
View
@@ -55,7 +55,9 @@ def show_totals():
should_abort_cb=should_abort,
read_event_cb=handle_line,
check_interval=1.0)
- d.start()
+ retcode = d.start()
+ print
+ print 'Exit code: %d' % retcode
print
print 'Total line count:'

0 comments on commit ec28381

Please sign in to comment.