geoipupdate icon indicating copy to clipboard operation
geoipupdate copied to clipboard

geoipupdate output written to stderr instead of stdout

Open dinodipardo opened this issue 2 years ago • 4 comments

All geoipupdate output is written to stderr instead of stdout, even on success:

{ { geoipupdate --version; } 2>&3 | sed 's/^/STDOUT: /'; } 3>&1 1>&2 | sed 's/^/STDERR: /' { { geoipupdate -h; } 2>&3 | sed 's/^/STDOUT: /'; } 3>&1 1>&2 | sed 's/^/STDERR: /'

dinodipardo avatar Dec 18 '23 11:12 dinodipardo

Yeah, I agree this is kind of odd, although I'm not sure it is technically wrong. It is a result of using Go's default logger. I'm not sure we'd want to change it at this point. #119 is related.

horgh avatar Dec 18 '23 17:12 horgh

Technically I think nothing is wrong. But from an automation perspective this doesn't make sense. If lasterror is 0 the version should be printed to stdout. Currently hard to process output in scripts since you need to capture both stdin and stderr to see if any output is generated independent on the error code

dinodipardo avatar Dec 18 '23 17:12 dinodipardo

Are you wanting to run --version automatically? We don't print any output unless it's an error (with non exit status 0) when run normally I believe.

horgh avatar Dec 18 '23 17:12 horgh

Using --version to detect if an new version should be installed

using it in PowerShell code image

dinodipardo avatar Dec 18 '23 17:12 dinodipardo