1
0
Fork 0

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.
pull/1573/head
Oliver Ford 2023-10-26 17:29:31 +01:00
parent fe3e7ce9a7
commit 7c60c0037a
No known key found for this signature in database
GPG Key ID: 15CCFACF010F70D2
1 changed files with 2 additions and 2 deletions

View File

@ -418,8 +418,8 @@ export class ToolRunner extends events.EventEmitter {
} }
const optionsNonNull = this._cloneExecOptions(this.options) const optionsNonNull = this._cloneExecOptions(this.options)
if (!optionsNonNull.silent && optionsNonNull.outStream) { if (!optionsNonNull.silent && optionsNonNull.errStream) {
optionsNonNull.outStream.write( optionsNonNull.errStream.write(
this._getCommandString(optionsNonNull) + os.EOL this._getCommandString(optionsNonNull) + os.EOL
) )
} }