From 14df23083f438200f242106b0dd3784e1c7938c4 Mon Sep 17 00:00:00 2001 From: Markus Siemens <msi@axxeo.de> Date: Thu, 17 Jan 2013 17:05:46 +0100 Subject: [PATCH] Add stdout option to GitCommandError --- git/cmd.py | 2 +- git/exc.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/git/cmd.py b/git/cmd.py index 576a5300a..d10ce1322 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -378,7 +378,7 @@ def execute(self, command, # END handle debug printing if with_exceptions and status != 0: - raise GitCommandError(command, status, stderr_value) + raise GitCommandError(command, status, stderr_value, stdout_value) # Allow access to the command's status code if with_extended_output: diff --git a/git/exc.py b/git/exc.py index d2cb8d7ea..344e6609e 100644 --- a/git/exc.py +++ b/git/exc.py @@ -17,14 +17,15 @@ class NoSuchPathError(OSError): class GitCommandError(Exception): """ Thrown if execution of the git command fails with non-zero status code. """ - def __init__(self, command, status, stderr=None): + def __init__(self, command, status, stderr=None, stdout=None): self.stderr = stderr + self.stdout = stdout self.status = status self.command = command def __str__(self): return ("'%s' returned exit status %i: %s" % - (' '.join(str(i) for i in self.command), self.status, self.stderr)) + (' '.join(str(i) for i in self.command), self.status, self.stderr, self.stdout)) class CheckoutError( Exception ):