diff options
Diffstat (limited to 'repo')
-rwxr-xr-x | repo | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -57,9 +57,14 @@ class Trace: | |||
57 | trace = Trace() | 57 | trace = Trace() |
58 | 58 | ||
59 | 59 | ||
60 | def cmdstr(cmd): | ||
61 | """Get a nicely quoted shell command.""" | ||
62 | return " ".join(shlex.quote(x) for x in cmd) | ||
63 | |||
64 | |||
60 | def exec_command(cmd): | 65 | def exec_command(cmd): |
61 | """Execute |cmd| or return None on failure.""" | 66 | """Execute |cmd| or return None on failure.""" |
62 | trace.print(":", " ".join(cmd)) | 67 | trace.print(":", cmdstr(cmd)) |
63 | try: | 68 | try: |
64 | if platform.system() == "Windows": | 69 | if platform.system() == "Windows": |
65 | ret = subprocess.call(cmd) | 70 | ret = subprocess.call(cmd) |
@@ -506,7 +511,7 @@ def run_command(cmd, **kwargs): | |||
506 | # Run & package the results. | 511 | # Run & package the results. |
507 | proc = subprocess.Popen(cmd, **kwargs) | 512 | proc = subprocess.Popen(cmd, **kwargs) |
508 | (stdout, stderr) = proc.communicate(input=cmd_input) | 513 | (stdout, stderr) = proc.communicate(input=cmd_input) |
509 | dbg = ": " + " ".join(cmd) | 514 | dbg = ": " + cmdstr(cmd) |
510 | if cmd_input is not None: | 515 | if cmd_input is not None: |
511 | dbg += " 0<|" | 516 | dbg += " 0<|" |
512 | if stdout == subprocess.PIPE: | 517 | if stdout == subprocess.PIPE: |
@@ -843,7 +848,7 @@ def _GetRepoConfig(name): | |||
843 | return None | 848 | return None |
844 | else: | 849 | else: |
845 | print( | 850 | print( |
846 | f"repo: error: git {' '.join(cmd)} failed:\n{ret.stderr}", | 851 | f"repo: error: git {cmdstr(cmd)} failed:\n{ret.stderr}", |
847 | file=sys.stderr, | 852 | file=sys.stderr, |
848 | ) | 853 | ) |
849 | # This will raise subprocess.CalledProcessError for us. | 854 | # This will raise subprocess.CalledProcessError for us. |