Skip to content

Fix issue #470 #475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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