Page 1 of 1

Binary exit code 0 on failed --apply-update

Posted: Mon Aug 10, 2015 7:32 am
by Bisa
I'm tinkering with scripting the update process (mainly for headless clients) and ran into an odd behaviour:
I'm running the core-linux64 package

Code: Select all

$ #Bash prompt
$ /opt/factorio/bin/x64/factorio --apply-update /tmp/nonexisting.zip
   0.000  Info Main.cpp:150: Program arguments: "/opt/factorio/bin/x64/factorio" "--apply-update" "/tmp/nonexisting.zip"
   0.000 2015-08-09 22:41:27; Factorio 0.12.2 (Build 16229, linux64)
   0.000 Operating system: Linux
   0.000 Read data path: /opt/factorio/data
   0.000 Write data path: /opt/factorio
   0.000 Binaries path: /opt/factorio/bin
   0.030 Running in headless mode
   0.035 Loading mod core 0.0.0 (data.lua)
   0.041 Loading mod base 0.12.2 (data.lua)
   0.979 Factorio initialised
   0.980 Info Updater.cpp:358: Applying update /tmp/factorio-update*.zip
   0.982 Error Util.cpp:46: Error opening update package: Opening zip /tmp/nonexisting.zip failed
   1.006 Goodbye

$ echo $?
   0
Despite the Error from Util.cpp:46 the binary exits with code 0 indicating "everything went well during my execution"

I'm not sure if you would consider this a bug but if the binary would give a proper exit code we could get around having to parse the output for errors which seems kinda hackish :D

Re: Binary exit code 0 on failed --apply-update

Posted: Mon Aug 10, 2015 9:04 am
by Oxyd
Yeah, sure. Factorio should return 1 on error everywhere else already, this seems to be the only case that was forgotten. Fixed in 0.12.4.

Re: Binary exit code 0 on failed --apply-update

Posted: Mon Aug 10, 2015 9:54 am
by Bisa
Cheers =)