Skip to content

Commit 930d03f

Browse files
authored
Merge pull request #475 from warsaw/issue470
Fix issue #470
2 parents 105a8c0 + dc2ec79 commit 930d03f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

git/cmd.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
PY3,
4040
bchr,
4141
# just to satisfy flake8 on py3
42-
unicode
42+
unicode,
43+
safe_decode,
4344
)
4445

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

695696
def as_text(stdout_value):
696-
return not output_stream and stdout_value.decode(defenc) or '<OUTPUT_STREAM>'
697+
return not output_stream and safe_decode(stdout_value) or '<OUTPUT_STREAM>'
697698
# end
698699

699700
if stderr_value:
700701
log.info("%s -> %d; stdout: '%s'; stderr: '%s'",
701-
cmdstr, status, as_text(stdout_value), stderr_value.decode(defenc))
702+
cmdstr, status, as_text(stdout_value), safe_decode(stderr_value))
702703
elif stdout_value:
703704
log.info("%s -> %d; stdout: '%s'", cmdstr, status, as_text(stdout_value))
704705
else:
@@ -712,11 +713,11 @@ def as_text(stdout_value):
712713
raise GitCommandError(command, status, stderr_value)
713714

714715
if isinstance(stdout_value, bytes) and stdout_as_string: # could also be output_stream
715-
stdout_value = stdout_value.decode(defenc)
716+
stdout_value = safe_decode(stdout_value)
716717

717718
# Allow access to the command's status code
718719
if with_extended_output:
719-
return (status, stdout_value, stderr_value.decode(defenc))
720+
return (status, stdout_value, safe_decode(stderr_value))
720721
else:
721722
return stdout_value
722723

0 commit comments

Comments
 (0)