diff options
author | Mike Frysinger <vapier@google.com> | 2020-02-21 23:45:08 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2020-02-22 05:56:06 +0000 |
commit | 71928c19a671b78ed39578d675d1d8b969a21a38 (patch) | |
tree | 0f512e34513424b8e3f18a26d27ac0818408f62f | |
parent | f5dbd2eb07f6a9cdb49b7a2dd157925963192ded (diff) | |
download | git-repo-71928c19a671b78ed39578d675d1d8b969a21a38.tar.gz |
repo: show redirects when tracing commands
This copies the output style we use in git_command for showing output
and input redirections.
Change-Id: I449b27e7b262e1b30b24333109a1d91d9c7b1ce7
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256453
Reviewed-by: Jonathan Nieder <jrn@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
-rwxr-xr-x | repo | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -382,7 +382,16 @@ def run_command(cmd, **kwargs): | |||
382 | # Run & package the results. | 382 | # Run & package the results. |
383 | proc = subprocess.Popen(cmd, **kwargs) | 383 | proc = subprocess.Popen(cmd, **kwargs) |
384 | (stdout, stderr) = proc.communicate(input=cmd_input) | 384 | (stdout, stderr) = proc.communicate(input=cmd_input) |
385 | trace.print(':', ' '.join(cmd)) | 385 | dbg = ': ' + ' '.join(cmd) |
386 | if cmd_input is not None: | ||
387 | dbg += ' 0<|' | ||
388 | if stdout == subprocess.PIPE: | ||
389 | dbg += ' 1>|' | ||
390 | if stderr == subprocess.PIPE: | ||
391 | dbg += ' 2>|' | ||
392 | elif stderr == subprocess.STDOUT: | ||
393 | dbg += ' 2>&1' | ||
394 | trace.print(dbg) | ||
386 | ret = RunResult(proc.returncode, decode(stdout), decode(stderr)) | 395 | ret = RunResult(proc.returncode, decode(stdout), decode(stderr)) |
387 | 396 | ||
388 | # If things failed, print useful debugging output. | 397 | # If things failed, print useful debugging output. |