diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-02-21 18:32:24 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-02-21 18:32:24 -0500 |
| commit | 6e2b99a0870e467e35c8b4b95aeb1e665dded413 (patch) | |
| tree | 1e4b4d000c6b53b93a35b5446dc774d4799c987c /run/executable/executable.py | |
| parent | 9bcbb4048cd82ea11ed469731eae95d808b99449 (diff) | |
Many bugfixes motivated by some end-to-end testing.
Diffstat (limited to 'run/executable/executable.py')
| -rw-r--r-- | run/executable/executable.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/run/executable/executable.py b/run/executable/executable.py index bc8edd7..0a408b7 100644 --- a/run/executable/executable.py +++ b/run/executable/executable.py | |||
| @@ -44,7 +44,6 @@ class Executable(object): | |||
| 44 | return full_command | 44 | return full_command |
| 45 | 45 | ||
| 46 | def __str__(self): | 46 | def __str__(self): |
| 47 | print("Full command: %s" % self.__get_full_command()) | ||
| 48 | return " ".join(self.__get_full_command()) | 47 | return " ".join(self.__get_full_command()) |
| 49 | 48 | ||
| 50 | def execute(self): | 49 | def execute(self): |
| @@ -63,7 +62,7 @@ class Executable(object): | |||
| 63 | '''Send the terminate signal to the binary.''' | 62 | '''Send the terminate signal to the binary.''' |
| 64 | self.sp.terminate() | 63 | self.sp.terminate() |
| 65 | 64 | ||
| 66 | def wait(self): | 65 | def wait(self, error=True): |
| 67 | '''Wait until the executable is finished, checking return code. | 66 | '''Wait until the executable is finished, checking return code. |
| 68 | 67 | ||
| 69 | If the exit status is non-zero, raise an exception. | 68 | If the exit status is non-zero, raise an exception. |
| @@ -71,8 +70,10 @@ class Executable(object): | |||
| 71 | ''' | 70 | ''' |
| 72 | 71 | ||
| 73 | self.sp.wait() | 72 | self.sp.wait() |
| 74 | if self.sp.returncode != 0: | 73 | if self.sp.returncode != 0 and error: |
| 75 | print >>sys.stderr, "Non-zero return: %s %s" % (self.exec_file, " ".join(self.extra_args)) | 74 | print >>sys.stderr, "Non-zero return %d: %s %s" % (self.sp.returncode, |
| 75 | self.exec_file, | ||
| 76 | " ".join(self.extra_args)) | ||
| 76 | return 0 | 77 | return 0 |
| 77 | else: | 78 | else: |
| 78 | return 1 | 79 | return 1 |
