TurboVNC / turbovnc

Main TurboVNC repository
https://TurboVNC.org
GNU General Public License v2.0
761 stars 138 forks source link

Print --help texts to stdout, not stderr, and exit successfully #275

Closed nh2 closed 3 years ago

nh2 commented 3 years ago

For unix programs it is common to print their --help text to stdout, not stderr, if --help is given directly.

It is also common that a direct invocation of --help sets the exit code to 0 (success), not 1 (failure).

TurboVNC's binaries, such as Xvnc, don't currently do that, making for confusing behaviour such as Xvnc --help | less not working as expected.

It would be awesome if this small change could be made!

dcommander commented 3 years ago

Xvnc is at the mercy of Xorg in this regard. The TurboVNC Server just tacks on additional TurboVNC-specific usage information to the existing Xorg usage screen, so we are bound by Xorg's choice of standard stream and usage arguments. There are several areas in which it was necessary to modify the Xorg source code and maintain a TurboVNC-specific patch, but I try to avoid that unless there is a compelling reason. Making the Xorg usage screen a bit more intuitive isn't compelling enough to justify the pain.

dcommander commented 3 years ago

As far as the exit code, there might be a way around that. I'll investigate.

dcommander commented 3 years ago

The exit code has been fixed, although please note that the vncserver script normally intercepts the -help argument, so you won't notice this fix unless you invoke /opt/TurboVNC/bin/Xvnc directly.

nh2 commented 3 years ago

Xvnc is at the mercy of Xorg in this regard.

Ah, I see. Indeed Xorg --help has the same issue. Might be something I could look into fixing upstream there.

Thank you!

dcommander commented 3 years ago

Xorg has the same issue in terms of printing to stderr, but it does exit with a 0 error code if you pass -help to it (but it doesn't understand --help.) TurboVNC's implementation of Xvnc now does the latter as well.