From 0788d55d7102fde6c40e3693b8d0266fd1291fba Mon Sep 17 00:00:00 2001 From: Oliver Ford Date: Thu, 26 Oct 2023 17:29:31 +0100 Subject: [PATCH] Fix tool output mangled with spawned cmd string Presently if the exec'd tool is expected to produce an output (i.e. to write to stdout) that can be consumed in a Unix pipeline, assigned to a variable, or similar; the `silent` option must be set in order to avoid the output being mangled by `@actions/exec` to include the full command string that it spawns. This commit writes the spawned command string to stderr instead of stdout, as would be expected for logging/debug information as opposed to consumable output data. Closes #649. --- packages/exec/src/toolrunner.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/exec/src/toolrunner.ts b/packages/exec/src/toolrunner.ts index a6ca34a2da..b873d0190e 100644 --- a/packages/exec/src/toolrunner.ts +++ b/packages/exec/src/toolrunner.ts @@ -418,8 +418,8 @@ export class ToolRunner extends events.EventEmitter { } const optionsNonNull = this._cloneExecOptions(this.options) - if (!optionsNonNull.silent && optionsNonNull.outStream) { - optionsNonNull.outStream.write( + if (!optionsNonNull.silent && optionsNonNull.errStream) { + optionsNonNull.errStream.write( this._getCommandString(optionsNonNull) + os.EOL ) }