Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exec should not fail if provided a command with a missing tool when using {ignoreReturnCode: true, failOnStdErr:false} #1625

Open
stephen-carter-at-sf opened this issue Jan 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@stephen-carter-at-sf
Copy link

stephen-carter-at-sf commented Jan 12, 2024

Describe the bug
I would expect that exec.exec('someCommandThatDoesNotExists', [], {ignoreReturnCode:true, failOnStdErr:false}) would simply return a Promise that resolves to 127.
Instead it appears that it throws an exception: which ultimately comes from the fact that it is using io.which with a check flag equal to true over at https://github.com/actions/toolkit/blob/main/packages/exec/src/toolrunner.ts#L411

To Reproduce
Steps to reproduce the behavior:
From a custom javascript based github action perform
const exitCode = await exec.exec('someCommandThatDoesNotExists', [], {ignoreReturnCode:true, failOnStdErr:false})
and a execute the action

Expected behavior
You'll find that instead of getting the exitCode to process yourself, an exception is thrown. This is not at all what is expected from users like myself when I explicitly requested to process the return code myself with
ignoreReturnCode:true, failOnStdErr:false

A Promise that resolves to 127 should be returned.

Desktop (please complete the following information):
all platforms

@stephen-carter-at-sf stephen-carter-at-sf added the bug Something isn't working label Jan 12, 2024
@stephen-carter-at-sf stephen-carter-at-sf changed the title exec should not fail if io.which fails when using {ignoreReturnCode: true, failOnStdErr:false} exec should not fail if provided a command with a missing tool when using {ignoreReturnCode: true, failOnStdErr:false} Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant