Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit678821a

Browse files
committed
Merge pull request#198 from folti/0.3
GitRunCommand exception can store stdout output too.
2 parents6404168 +48f5476 commit678821a

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

‎git/cmd.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,10 @@ def execute(self, command,
380380
# END handle debug printing
381381

382382
ifwith_exceptionsandstatus!=0:
383-
raiseGitCommandError(command,status,stderr_value)
383+
ifwith_extended_output:
384+
raiseGitCommandError(command,status,stderr_value,stdout_value)
385+
else:
386+
raiseGitCommandError(command,status,stderr_value)
384387

385388
# Allow access to the command's status code
386389
ifwith_extended_output:

‎git/exc.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@ class NoSuchPathError(OSError):
1717

1818
classGitCommandError(Exception):
1919
""" Thrown if execution of the git command fails with non-zero status code. """
20-
def__init__(self,command,status,stderr=None):
20+
def__init__(self,command,status,stderr=None,stdout=None):
2121
self.stderr=stderr
22+
self.stdout=stdout
2223
self.status=status
2324
self.command=command
2425

2526
def__str__(self):
26-
return ("'%s' returned exit status %i: %s"%
27-
(' '.join(str(i)foriinself.command),self.status,self.stderr))
27+
ret="'%s' returned exit status %i: %s"% \
28+
(' '.join(str(i)foriinself.command),self.status,self.stderr)
29+
ifself.stdoutisnotNone:
30+
ret+="\nstdout: %s"%self.stdout
31+
returnret
2832

2933

3034
classCheckoutError(Exception ):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp