apertium / lttoolbox

Finite state compiler, processor and helper tools used by apertium
http://wiki.apertium.org/wiki/Lttoolbox
GNU General Public License v2.0
18 stars 22 forks source link

Move log messages to stderr #170

Closed ZJaume closed 1 year ago

ZJaume commented 1 year ago

Hi everyone, Prompsit fellow here!

The standard way of doing this in Unix is to use stderr. Otherwise, if the program is inside a pipe and fails due to wrong arguments for example, the help message gets scrambled with standard output and input. I also changed the tmx_compiler.cc because the method already has an output file, so I'm assuming messages have to go to stderr. But I don't know how that component works and what the printed information means.

TinoDidriksen commented 1 year ago

Error message should indeed go to stderr, but usage should not normally do so. It is important that -? / -h / --help output goes to stdout.

ZJaume commented 1 year ago

So I guess the print_usage should print to stderr only when errors occurr?

TinoDidriksen commented 1 year ago

Yeah, which is pretty simple to accomplish - just pass in stdout or stderr.

ZJaume commented 1 year ago

I found that bash commands print to stderr when -? but stdout with -h, is this ok for you or do you prefer -? also in stdout? I think -? is an error and should go to stderr for the reasons I was pointing out at the beginning.

TinoDidriksen commented 1 year ago

I have merged an altered version of your suggestion.

ZJaume commented 1 year ago

Thank you! I was indeed waiting for your response to push that modications.