Skip to content

Commit

Permalink
Fix tool output mangled with spawned cmd string
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
OJFord committed Oct 26, 2023
1 parent fe3e7ce commit 0788d55
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/exec/src/toolrunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}
Expand Down

0 comments on commit 0788d55

Please sign in to comment.