Skip to content

Commit

Permalink
Merge pull request gitpython-developers#475 from warsaw/issue470
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron authored Jun 20, 2016
2 parents 105a8c0 + dc2ec79 commit 930d03f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions git/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
PY3,
bchr,
# just to satisfy flake8 on py3
unicode
unicode,
safe_decode,
)

execute_kwargs = ('istream', 'with_keep_cwd', 'with_extended_output',
Expand Down Expand Up @@ -693,12 +694,12 @@ def _kill_process(pid):
cmdstr = " ".join(command)

def as_text(stdout_value):
return not output_stream and stdout_value.decode(defenc) or '<OUTPUT_STREAM>'
return not output_stream and safe_decode(stdout_value) or '<OUTPUT_STREAM>'
# end

if stderr_value:
log.info("%s -> %d; stdout: '%s'; stderr: '%s'",
cmdstr, status, as_text(stdout_value), stderr_value.decode(defenc))
cmdstr, status, as_text(stdout_value), safe_decode(stderr_value))
elif stdout_value:
log.info("%s -> %d; stdout: '%s'", cmdstr, status, as_text(stdout_value))
else:
Expand All @@ -712,11 +713,11 @@ def as_text(stdout_value):
raise GitCommandError(command, status, stderr_value)

if isinstance(stdout_value, bytes) and stdout_as_string: # could also be output_stream
stdout_value = stdout_value.decode(defenc)
stdout_value = safe_decode(stdout_value)

# Allow access to the command's status code
if with_extended_output:
return (status, stdout_value, stderr_value.decode(defenc))
return (status, stdout_value, safe_decode(stderr_value))
else:
return stdout_value

Expand Down

0 comments on commit 930d03f

Please sign in to comment.