Don't fail just because a subprocess wrote stuff to stderr
authorKarl Hasselström <kha@treskal.com>
Wed, 29 Aug 2007 12:24:15 +0000 (14:24 +0200)
committerKarl Hasselström <kha@treskal.com>
Fri, 31 Aug 2007 06:54:50 +0000 (08:54 +0200)
Instead, pass the message on to the user and assume the subprocess was
successful. We need to do this since some git commands print warnings
on stderr even though they succeed.

Signed-off-by: Karl Hasselström <kha@treskal.com>
stgit/run.py

index ae3a2e1..94dd98e 100644 (file)
@@ -79,9 +79,12 @@ class Run:
         errdata = p.childerr.read()
         self.exitcode = p.wait() >> 8
         self.__log_end(self.exitcode)
-        if errdata or self.exitcode not in self.__good_retvals:
+        if self.exitcode not in self.__good_retvals:
             raise self.exc('%s failed with code %d:\n%s'
                            % (cmd[0], self.exitcode, errdata))
+        if errdata:
+            out.warn('call to %s succeeded, but generated a warning:' % cmd[0])
+            out.err_raw(errdata)
         return outdata
     def __run_noshell(self, cmd):
         """Run without captured IO. Note: arguments are not parsed by