From 696e4edd6c6d20d13e53a93759e63c675532af05 Mon Sep 17 00:00:00 2001
From: Jim Wisniewski <jwisniewski@flatiron.com>
Date: Wed, 30 Dec 2020 14:33:56 -0500
Subject: [PATCH] fix universal_newlines TypeError

---
 git/cmd.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/git/cmd.py b/git/cmd.py
index acea40c5a..836aafffb 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -772,6 +772,7 @@ def _kill_process(pid):
         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 @@ def _kill_process(pid):
                         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 @@ def _kill_process(pid):
                 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