MantisBT - Doomseeker
View Issue Details
0003282Doomseeker[All Projects] Bugpublic2017-10-03 05:422018-10-27 22:55
WubTheCaptain 
Zalewa 
lowtweakalways
closedfixed 
x86_64 (really cross-platform)Debian GNU/Linuxbuster/sid
1.1 
1.21.2 
0003282: Omitting file from --version-json command line parameter doesn't print to standard output
The --version-json command line parameter requires a file. It should be changed to optional, and output to stdout at least when the file is omitted after the parameter.
$ doomseeker --version-json                             
[05:35:51] No file specified!
doomseeker --version-json /dev/stdout
works. This is not ideal, and doesn't work very well with shell redirection to cat/less/more etc.

This should be shell-agnostic to any POSIX-like shell, but my choice of shell here was mksh:

$ echo $SHELL
/bin/mksh
No tags attached.
related to 0003247confirmed  Doomseeker's manual page (mdoc/nroff) is missing or incomplete 
related to 0003372closed Zalewa Diagnostics messages are written to stdout (instead of stderr) 
child of 0003279acknowledged  List of Debian issues (misc/non-policy) 
Issue History
2017-10-03 05:42WubTheCaptainNew Issue
2017-10-03 05:43WubTheCaptainRelationship addedchild of 0003279
2017-10-03 05:44WubTheCaptainPrioritynormal => low
2017-10-03 05:47WubTheCaptainDescription Updatedbug_revision_view_page.php?rev_id=11029#r11029
2017-10-03 06:00WubTheCaptainNote Added: 0018419
2017-10-04 16:19ZalewaNote Added: 0018433
2017-10-04 16:19ZalewaAssigned To => Zalewa
2017-10-04 16:19ZalewaStatusnew => acknowledged
2017-10-07 08:56WubTheCaptainRelationship addedrelated to 0003247
2018-02-14 11:02ZalewaStatusacknowledged => assigned
2018-02-14 12:02ZalewaNote Added: 0019037
2018-02-14 12:02ZalewaStatusassigned => needs review
2018-02-15 01:18WubTheCaptainTarget Version => 1.2
2018-02-15 01:40WubTheCaptainNote Added: 0019040
2018-02-15 01:47WubTheCaptainNote Added: 0019041
2018-02-15 01:47WubTheCaptainStatusneeds review => resolved
2018-02-15 01:47WubTheCaptainFixed in Version => 1.2
2018-02-15 01:47WubTheCaptainResolutionopen => fixed
2018-02-15 01:48WubTheCaptainNote Edited: 0019041bug_revision_view_page.php?bugnote_id=19041#r11391
2018-02-15 02:06WubTheCaptainRelationship addedrelated to 0003372
2018-10-27 22:55WubTheCaptainStatusresolved => closed

Notes
(0018419)
WubTheCaptain   
2017-10-03 06:00   
By the way, the --help command describes the file to be optional (when it really is not) with brackets:

--version-json [file]
    Prints version info on Doomseeker and all
    plugins in JSON format to specified file,
    then closes the program.
(0018433)
Zalewa   
2017-10-04 16:19   
I agree. The reason I omitted that originally was because this cmdline arg is used for preparing the update packages for auto-updater. On Windows, programs compiled with /SUBSYSTEM:WINDOWS won't print anything to stdout/stderr. Hence it's always necessary to pass the argument.

It won't do harm to also support the argumentless version.
(0019037)
Zalewa   
2018-02-14 12:02   
First of all, logs were written to stdout so they needed to be moved to stderr:'https://bitbucket.org/Doomseeker/doomseeker/commits/87122ce09493fbad5fe718acf64ef2950167fd13 [^]'

Once this was done, "--version-json" could be instructed to write to stdout if there's no file or if file was specified as '-'
'https://bitbucket.org/Doomseeker/doomseeker/commits/c483a8a197d9aadd69cbe12520b96e7404057a1d [^]'
(0019040)
WubTheCaptain   
2018-02-15 01:40   
It's not perhaps ideal, but at least the following works for JSON only stdout:

$ ./doomseeker --version-json 2>/dev/null | less
$ ./doomseeker --version-json - 2>/dev/null | less
(0019041)
WubTheCaptain   
2018-02-15 01:47   
(edited on: 2018-02-15 01:48)
Since something like standard UNIX shell redirection is now also possible:

./doomseeker --version-json > /tmp/version-info.json


with proper JSON instead of the "no file specified" error in the output, I'm going to assume this is resolved.