DaemonEngine / Daemon

The Dæmon game engine. With some bits of ioq3 and XreaL.
https://unvanquished.net
BSD 3-Clause "New" or "Revised" License
300 stars 60 forks source link

`daemon --help` only prints help in interactive terminals #631

Open illwieckz opened 2 years ago

illwieckz commented 2 years ago

daemon --help only prints help in interactive terminals:

$ ./daemon --help
Unvanquished 0.52.1 Linux x86_64 May 28 2022
cmdline: --help
Usage: daemon [-OPTION]... [-connect <uri> | +COMMAND...]

Possible options are:
  -h, -help                print this help and exit
  -v, -version             print version and exit
  -homepath <path>         set the path used for user-specific configuration files and downloaded dpk files
  -libpath <path>          set the path containing additional executables and libraries
  -pakpath <path>          add another path from which dpk files are loaded
  -resetconfig             reset all cvars and keybindings to their default value
  -curses                  activate the curses interface
  -set <variable> <value>  set the value of a cvar
  -connect unv://<address>[:<port>]>
                           connect to server at startup
  +<command> <args>        execute an ingame command after startup

Order is important, -options must be set before +commands.
Nothing is read and executed after -connect option and the following URI.
If another instance is already running, commands will be forwarded to it.
$ ./daemon --help | cat
Unvanquished 0.52.1 Linux x86_64 May 28 2022
cmdline: --help
$ echo "$(./daemon --help)"
Unvanquished 0.52.1 Linux x86_64 May 28 2022
cmdline: --help
$ unbuffer ./daemon --help | cat
Unvanquished 0.52.1 Linux x86_64 May 28 2022
cmdline: --help
Usage: ./daemon [-OPTION]... [-connect <uri> | +COMMAND...]

Possible options are:
  -h, -help                print this help and exit
  -v, -version             print version and exit
  -homepath <path>         set the path used for user-specific configuration files and downloaded dpk files
  -libpath <path>          set the path containing additional executables and libraries
  -pakpath <path>          add another path from which dpk files are loaded
  -resetconfig             reset all cvars and keybindings to their default value
  -curses                  activate the curses interface
  -set <variable> <value>  set the value of a cvar
  -connect unv://<address>[:<port>]>
                           connect to server at startup
  +<command> <args>        execute an ingame command after startup

Order is important, -options must be set before +commands.
Nothing is read and executed after -connect option and the following URI.
If another instance is already running, commands will be forwarded to it.
illwieckz commented 2 years ago

Same with ./daemon -v.

illwieckz commented 2 years ago

That's weird because the code relies on basic printf.

Also the code seems to run as other command line options like the -connect action is working.

illwieckz commented 2 years ago

It prints things correctly if I replace printf by Log::Notice, even with -curses (it's probably too early to get this printed into the curses console and then wiped out at exiting).

illwieckz commented 2 years ago

Also I was afraid that by using Log::Notice the help message gets written in daemon.log but this is indeed too early (because the homepath is not known yest since it's expected to be modifiable there).