posix: exit if the startup script is not ok

In general, if anything goes wrong in the startup script, we
should fail entirely because things might not work as expected.

In particular, this prevents that we have to press Ctrl+C twice if the
simulator start call is hung waiting for the simulator to appear and
start communicating. We now press Ctrl+C once and exit straightaway
whereas before we would press it once to get the warning:
"Startup script returned with return value: 2",
and then finally exit on the second press.
This commit is contained in:
Julian Oes
2019-11-18 14:25:09 +01:00
committed by Lorenz Meier
parent 8817f172ea
commit 16da8466e3

View File

@@ -288,6 +288,10 @@ int main(int argc, char **argv)
ret = run_startup_script(commands_file, absolute_binary_path, instance);
if (ret != 0) {
return PX4_ERROR;
}
// We now block here until we need to exit.
if (pxh_off) {
wait_to_exit();