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

"Hangs" on unknown options #58

Open
apjanke opened this issue Aug 20, 2024 · 0 comments
Open

"Hangs" on unknown options #58

apjanke opened this issue Aug 20, 2024 · 0 comments
Assignees
Labels
bug Somethin ain't right
Milestone

Comments

@apjanke
Copy link
Collaborator

apjanke commented Aug 20, 2024

If you pass cowsay -v or -V (asking for a version, but incorrectly), or some other unknown option, cowsay seems to hang after the error message.

[cowsay] $ ./bin/cowsay -V
Unknown option: V

That's because it's doing the default behavior of reading from stdin and waiting for input.

Might be better for it to just die and exit upon any unknown options.

Maybe should go broader, and ignore stdin if it's a terminal, so you only get the "read from stdin" behavior when piping to it. Might fix unintentional hangs in some cases.

UPDATE 2024-11-30: Looks like this also hangs on empty messages on the command line.

$ cowsay ''

It just sits there for me, doing nothing. If I type "Hello" and then Ctrl-D, it emits a "Hello" message. I think empty-string for the message argument is not being recognized as distinct from no message argument at all.

Changing that could be a breaking change. Users might be using '' to mean "read from stdin" like its current behavior does.

@apjanke apjanke self-assigned this Aug 20, 2024
@apjanke apjanke added the bug Somethin ain't right label Aug 20, 2024
@apjanke apjanke added this to Cowsay Aug 20, 2024
@apjanke apjanke added this to the The Future milestone Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Somethin ain't right
Projects
Status: Todo
Development

No branches or pull requests

1 participant