diff options
Diffstat (limited to 'git_command.py')
| -rw-r--r-- | git_command.py | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/git_command.py b/git_command.py index 19100fa9..56e18e02 100644 --- a/git_command.py +++ b/git_command.py | |||
| @@ -230,12 +230,11 @@ 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 = '' | ||
| 233 | if IsTrace(): | 234 | if IsTrace(): |
| 234 | global LAST_CWD | 235 | global LAST_CWD |
| 235 | global LAST_GITDIR | 236 | global LAST_GITDIR |
| 236 | 237 | ||
| 237 | dbg = '' | ||
| 238 | |||
| 239 | if cwd and LAST_CWD != cwd: | 238 | if cwd and LAST_CWD != cwd: |
| 240 | if LAST_GITDIR or LAST_CWD: | 239 | if LAST_GITDIR or LAST_CWD: |
| 241 | dbg += '\n' | 240 | dbg += '\n' |
| @@ -263,31 +262,31 @@ class GitCommand(object): | |||
| 263 | dbg += ' 2>|' | 262 | dbg += ' 2>|' |
| 264 | elif stderr == subprocess.STDOUT: | 263 | elif stderr == subprocess.STDOUT: |
| 265 | dbg += ' 2>&1' | 264 | 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)) | ||
| 279 | |||
| 280 | if ssh_proxy: | ||
| 281 | ssh_proxy.add_client(p) | ||
| 282 | 265 | ||
| 283 | self.process = p | 266 | with Trace('git command %s %s with debug: %s', LAST_GITDIR, command, dbg): |
| 267 | try: | ||
| 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)) | ||
| 284 | 278 | ||
| 285 | try: | ||
| 286 | self.stdout, self.stderr = p.communicate(input=input) | ||
| 287 | finally: | ||
| 288 | if ssh_proxy: | 279 | if ssh_proxy: |
| 289 | ssh_proxy.remove_client(p) | 280 | ssh_proxy.add_client(p) |
| 290 | self.rc = p.wait() | 281 | |
| 282 | self.process = p | ||
| 283 | |||
| 284 | try: | ||
| 285 | self.stdout, self.stderr = p.communicate(input=input) | ||
| 286 | finally: | ||
| 287 | if ssh_proxy: | ||
| 288 | ssh_proxy.remove_client(p) | ||
| 289 | self.rc = p.wait() | ||
| 291 | 290 | ||
| 292 | @staticmethod | 291 | @staticmethod |
| 293 | def _GetBasicEnv(): | 292 | def _GetBasicEnv(): |
