summaryrefslogtreecommitdiffstats
path: root/git_command.py
diff options
context:
space:
mode:
Diffstat (limited to 'git_command.py')
-rw-r--r--git_command.py47
1 files changed, 24 insertions, 23 deletions
diff --git a/git_command.py b/git_command.py
index 56e18e02..19100fa9 100644
--- a/git_command.py
+++ b/git_command.py
@@ -230,11 +230,12 @@ class GitCommand(object):
230 stderr = (subprocess.STDOUT if merge_output else 230 stderr = (subprocess.STDOUT if merge_output else
231 (subprocess.PIPE if capture_stderr else None)) 231 (subprocess.PIPE if capture_stderr else None))
232 232
233 dbg = ''
234 if IsTrace(): 233 if IsTrace():
235 global LAST_CWD 234 global LAST_CWD
236 global LAST_GITDIR 235 global LAST_GITDIR
237 236
237 dbg = ''
238
238 if cwd and LAST_CWD != cwd: 239 if cwd and LAST_CWD != cwd:
239 if LAST_GITDIR or LAST_CWD: 240 if LAST_GITDIR or LAST_CWD:
240 dbg += '\n' 241 dbg += '\n'
@@ -262,31 +263,31 @@ class GitCommand(object):
262 dbg += ' 2>|' 263 dbg += ' 2>|'
263 elif stderr == subprocess.STDOUT: 264 elif stderr == subprocess.STDOUT:
264 dbg += ' 2>&1' 265 dbg += ' 2>&1'
266 Trace('%s', dbg)
267
268 try:
269 p = subprocess.Popen(command,
270 cwd=cwd,
271 env=env,
272 encoding='utf-8',
273 errors='backslashreplace',
274 stdin=stdin,
275 stdout=stdout,
276 stderr=stderr)
277 except Exception as e:
278 raise GitError('%s: %s' % (command[1], e))
265 279
266 with Trace('git command %s %s with debug: %s', LAST_GITDIR, command, dbg): 280 if ssh_proxy:
267 try: 281 ssh_proxy.add_client(p)
268 p = subprocess.Popen(command,
269 cwd=cwd,
270 env=env,
271 encoding='utf-8',
272 errors='backslashreplace',
273 stdin=stdin,
274 stdout=stdout,
275 stderr=stderr)
276 except Exception as e:
277 raise GitError('%s: %s' % (command[1], e))
278
279 if ssh_proxy:
280 ssh_proxy.add_client(p)
281 282
282 self.process = p 283 self.process = p
283 284
284 try: 285 try:
285 self.stdout, self.stderr = p.communicate(input=input) 286 self.stdout, self.stderr = p.communicate(input=input)
286 finally: 287 finally:
287 if ssh_proxy: 288 if ssh_proxy:
288 ssh_proxy.remove_client(p) 289 ssh_proxy.remove_client(p)
289 self.rc = p.wait() 290 self.rc = p.wait()
290 291
291 @staticmethod 292 @staticmethod
292 def _GetBasicEnv(): 293 def _GetBasicEnv():