cowsay-org / cowsay

apjanke's fork of the classic cowsay project
http://cowsay.diamonds
GNU General Public License v3.0
73 stars 15 forks source link

"Hangs" on unknown options #58

Open apjanke opened 4 weeks ago

apjanke commented 4 weeks ago

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.