summaryrefslogtreecommitdiff
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, 23 insertions, 24 deletions
diff --git a/git_command.py b/git_command.py
index 19100fa96..56e18e020 100644
--- a/git_command.py
+++ b/git_command.py
@@ -230,12 +230,11 @@ class GitCommand(object):
stderr = (subprocess.STDOUT if merge_output else
(subprocess.PIPE if capture_stderr else None))
+ dbg = ''
if IsTrace():
global LAST_CWD
global LAST_GITDIR
- dbg = ''
-
if cwd and LAST_CWD != cwd:
if LAST_GITDIR or LAST_CWD:
dbg += '\n'
@@ -263,31 +262,31 @@ class GitCommand(object):
dbg += ' 2>|'
elif stderr == subprocess.STDOUT:
dbg += ' 2>&1'
- Trace('%s', dbg)
-
- try:
- p = subprocess.Popen(command,
- cwd=cwd,
- env=env,
- encoding='utf-8',
- errors='backslashreplace',
- stdin=stdin,
- stdout=stdout,
- stderr=stderr)
- except Exception as e:
- raise GitError('%s: %s' % (command[1], e))
-
- if ssh_proxy:
- ssh_proxy.add_client(p)
- self.process = p
+ with Trace('git command %s %s with debug: %s', LAST_GITDIR, command, dbg):
+ try:
+ p = subprocess.Popen(command,
+ cwd=cwd,
+ env=env,
+ encoding='utf-8',
+ errors='backslashreplace',
+ stdin=stdin,
+ stdout=stdout,
+ stderr=stderr)
+ except Exception as e:
+ raise GitError('%s: %s' % (command[1], e))
- try:
- self.stdout, self.stderr = p.communicate(input=input)
- finally:
if ssh_proxy:
- ssh_proxy.remove_client(p)
- self.rc = p.wait()
+ ssh_proxy.add_client(p)
+
+ self.process = p
+
+ try:
+ self.stdout, self.stderr = p.communicate(input=input)
+ finally:
+ if ssh_proxy:
+ ssh_proxy.remove_client(p)
+ self.rc = p.wait()
@staticmethod
def _GetBasicEnv():