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

Plugin hides failure of command if stdin is closed #266

Closed
dominics opened this issue Feb 3, 2022 · 5 comments · Fixed by #566
Closed

Plugin hides failure of command if stdin is closed #266

dominics opened this issue Feb 3, 2022 · 5 comments · Fixed by #566

Comments

@dominics
Copy link

dominics commented Feb 3, 2022

When the plugin is installed, and the CLI is called with no available stdin (note: <&- is bash for "close stdin", but this also happens with e.g. < /dev/null)

$ my-cli this-does-not-exist <&-
 ›   Warning: this-does-not-exist is not a my-cli command.
Did you mean some-other-command? [y/n]:
$ echo $?
0

Then, the CLI exits with a zero (successful) exit code, even though no command was found or executed, and no answer was given to the not-found prompt.

This should instead be an error exit code.

@peternhale
Copy link
Contributor

@dominics Thank you for raising this issue. We will investigate the cause.

@mdonnalley
Copy link
Contributor

@dominics I'm not seeing this on the latest versions of @oclif/core (1.3.1) and plugin-not-found (2.3.1)

~/repos/oclif/plugin-not-found [main] : sf updte <&-
 ›   Warning: updte is not a sf command.

 ›   Error: command updte not found
~/repos/oclif/plugin-not-found [main] : echo $?
2

Can you try updating to those versions and seeing if this is still an issue? Thanks!

@dominics
Copy link
Author

dominics commented Feb 10, 2022

Yes, this still seems to be an issue. Circling back with a command you can run/see.

The original problem was happening on a private repository, so I've ported an open source project of mine from Oclif v1 to v2, to verify it's still happening in the latest versions, and to help with reproduction:

$ npx monofo@5.0.2 piiipeline < /dev/null
npx: installed 263 in 29.068s
 ›   Warning: piiipeline is not a monofo command.
Did you mean pipeline? [y/n]:
$ echo $?
0

This is using @oclif/core 1.3.3 and plugin-not-found 2.3.1 - right up to date.

Using the in-repo version of the run script above fails the same way (e.g. ./bin/run from within monofo, rather than npx monofo@5.0.2). so it's probably not my packaging (but could be the run script itself I guess). I'm also not using ts-node, if that matters at all.

@mdonnalley
Copy link
Contributor

@dominics thanks for the response. Unfortunately, I don't think this is something our team is able to prioritize right now.

However, we are more than happy to accept a PR if you want to find a solution yourself

Copy link

git2gus bot commented Mar 7, 2024

This issue has been linked to a new work item: W-15205956

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants