From 2c5d22429b0b9e35684af0812228aea41b8425ce Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Sun, 11 Jun 2006 13:05:56 +0100 Subject: [PATCH] Show the stderr for failed GIT commands This allows easier diagnosis of the faults. Signed-off-by: Catalin Marinas --- stgit/git.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/stgit/git.py b/stgit/git.py index 05d851d..b7f3269 100644 --- a/stgit/git.py +++ b/stgit/git.py @@ -117,20 +117,23 @@ def _input(cmd, file_desc): p.tochild.write(line) p.tochild.close() if p.wait(): - raise GitException, '%s failed' % str(cmd) + raise GitException, '%s failed (%s)' % (str(cmd), + p.childerr.read().strip()) def _input_str(cmd, string): p = popen2.Popen3(cmd, True) p.tochild.write(string) p.tochild.close() if p.wait(): - raise GitException, '%s failed' % str(cmd) + raise GitException, '%s failed (%s)' % (str(cmd), + p.childerr.read().strip()) def _output(cmd): p=popen2.Popen3(cmd, True) output = p.fromchild.read() if p.wait(): - raise GitException, '%s failed' % str(cmd) + raise GitException, '%s failed (%s)' % (str(cmd), + p.childerr.read().strip()) return output def _output_one_line(cmd, file_desc = None): @@ -141,14 +144,16 @@ def _output_one_line(cmd, file_desc = None): p.tochild.close() output = p.fromchild.readline().strip() if p.wait(): - raise GitException, '%s failed' % str(cmd) + raise GitException, '%s failed (%s)' % (str(cmd), + p.childerr.read().strip()) return output def _output_lines(cmd): p=popen2.Popen3(cmd, True) lines = p.fromchild.readlines() if p.wait(): - raise GitException, '%s failed' % str(cmd) + raise GitException, '%s failed (%s)' % (str(cmd), + p.childerr.read().strip()) return lines def __run(cmd, args=None): -- 2.11.0