Skip to content

Commit ca36771

Browse files
vecchiot-awstedinski
authored andcommitted
Fix dry-run to print to stdout when output_to is not stdout. (rust-lang#366)
1 parent 3a1fe68 commit ca36771

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

scripts/rmc.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,12 @@ def run_cmd(cmd, label=None, cwd=None, env=None, output_to=None, quiet=False, ve
100100
# If this a dry run, we emulate running a successful process whose output is the command itself
101101
# We set `output_to` to `stdout` so that the output is not omitted below
102102
if dry_run:
103-
if output_to == None:
104-
output_to = "stdout"
105103
cmd_line = ' '.join(cmd)
104+
if output_to != "stdout" and output_to is not None:
105+
cmd_line += f" > \"{output_to}\""
106+
107+
output_to = "stdout"
108+
106109
process = subprocess.CompletedProcess(None, EXIT_CODE_SUCCESS, stdout=cmd_line)
107110
else:
108111
process = subprocess.run(

0 commit comments

Comments
 (0)