3 ms·
The advantage of outputting help text to stdout is that you can pipe it to a pager. And since getting help is not an error, the exit code is 0. From what you
by ithkuil 12y ago
The advantage of outputting help text to stdout is that you can pipe it to a pager.
And since getting help is not an error, the exit code is 0.
From what you pasted it doesn't seem to check whether stdout exists, but whether stdin is a terminal. The intended use case is "your_program <input_file" => read from stdin; "your_program" => complain that you forgot a cmdline parameter (instead of blocking waiting for you to type something).