From 71928c19a671b78ed39578d675d1d8b969a21a38 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 21 Feb 2020 23:45:08 -0500 Subject: [PATCH] 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 Tested-by: Mike Frysinger --- repo | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/repo b/repo index 024ad1ce..32ad4cbb 100755 --- a/repo +++ b/repo @@ -382,7 +382,16 @@ def run_command(cmd, **kwargs): # Run & package the results. proc = subprocess.Popen(cmd, **kwargs) (stdout, stderr) = proc.communicate(input=cmd_input) - trace.print(':', ' '.join(cmd)) + dbg = ': ' + ' '.join(cmd) + if cmd_input is not None: + dbg += ' 0<|' + if stdout == subprocess.PIPE: + dbg += ' 1>|' + if stderr == subprocess.PIPE: + dbg += ' 2>|' + elif stderr == subprocess.STDOUT: + dbg += ' 2>&1' + trace.print(dbg) ret = RunResult(proc.returncode, decode(stdout), decode(stderr)) # If things failed, print useful debugging output.