From 7c60c0037aac5ba8267cf45531b7e11647444885 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 (and then re-writing out from the provided stdout listener). 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 a6ca34a2..b873d019 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 ) }