batctl outputs errors to stdout
Calls of batctl like "batctl if foo" output error messages to stdout instead of stderr.
This is important for scrips so that errors messages can be filtered out.
In short; "batctl if foo 2> /dev/null" doesn't work. :)
Updated by M W over 8 years ago
I have made a preliminary patch - see attachment.
At the moment the usage information is printed
in cases of an error (atm. to stdout still).
So the question arises if the usage should be redirected
to stderr as well in case it is displayed because of an error.
Or we remove the usage display and only display it when -h
is used. Imo, this approach would make the error output less cluttered.
Updated by Marek Lindner over 8 years ago
The patch looks pretty good!
IMHO, you can always direct the usage to stderr. If somebody calls the help on purpose he won't redirect the error output to /dev/null ?
Personally, I like having the help displayed in case of an error. Most people don't know how to continue if something does not work as expected.