From c6f5ba15ff66853d474b0a4e192f49de091da1c0 Mon Sep 17 00:00:00 2001 From: Thomas Del Vecchio Date: Wed, 28 Jul 2021 14:03:43 -0400 Subject: [PATCH] Fix dry-run to print to stdout when output_to is not stdout. --- scripts/rmc.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/rmc.py b/scripts/rmc.py index e2fdee7b2ca1..4c6cf27bfba0 100644 --- a/scripts/rmc.py +++ b/scripts/rmc.py @@ -100,9 +100,12 @@ def run_cmd(cmd, label=None, cwd=None, env=None, output_to=None, quiet=False, ve # If this a dry run, we emulate running a successful process whose output is the command itself # We set `output_to` to `stdout` so that the output is not omitted below if dry_run: - if output_to == None: - output_to = "stdout" cmd_line = ' '.join(cmd) + if output_to != "stdout" and output_to is not None: + cmd_line += f" > \"{output_to}\"" + + output_to = "stdout" + process = subprocess.CompletedProcess(None, EXIT_CODE_SUCCESS, stdout=cmd_line) else: process = subprocess.run(