summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Wisniewski <jwisniewski@flatiron.com>2020-12-30 14:33:56 -0500
committerJim Wisniewski <jwisniewski@flatiron.com>2020-12-30 14:33:56 -0500
commit696e4edd6c6d20d13e53a93759e63c675532af05 (patch)
tree005cefb83e29ea79fc07e6fdc5978366595bfec2
parent1e4211b20e8e57fe7b105b36501b8fc9e818852f (diff)
downloadgitpython-696e4edd6c6d20d13e53a93759e63c675532af05.tar.gz
fix universal_newlines TypeError
-rw-r--r--git/cmd.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/git/cmd.py b/git/cmd.py
index acea40c5..836aafff 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -772,6 +772,7 @@ class Git(LazyMixin):
status = 0
stdout_value = b''
stderr_value = b''
+ newline = "\n" if universal_newlines else b"\n"
try:
if output_stream is None:
if kill_after_timeout:
@@ -783,9 +784,9 @@ class Git(LazyMixin):
stderr_value = ('Timeout: the command "%s" did not complete in %d '
'secs.' % (" ".join(command), kill_after_timeout)).encode(defenc)
# strip trailing "\n"
- if stdout_value.endswith(b"\n"):
+ if stdout_value.endswith(newline):
stdout_value = stdout_value[:-1]
- if stderr_value.endswith(b"\n"):
+ if stderr_value.endswith(newline):
stderr_value = stderr_value[:-1]
status = proc.returncode
else:
@@ -794,7 +795,7 @@ class Git(LazyMixin):
stdout_value = proc.stdout.read()
stderr_value = proc.stderr.read()
# strip trailing "\n"
- if stderr_value.endswith(b"\n"):
+ if stderr_value.endswith(newline):
stderr_value = stderr_value[:-1]
status = proc.wait()
# END stdout handling