fix(core): fix edge case that prevented daemon from detecting a worker failure due to a signal. Fix #788

This commit is contained in:
Federico Terzi 2021-10-13 21:17:17 +02:00
parent 82c05d6615
commit af70305ccc
2 changed files with 7 additions and 2 deletions

View File

@ -32,8 +32,8 @@ use crate::{
common_flags::*,
exit_code::{
DAEMON_ALREADY_RUNNING, DAEMON_FATAL_CONFIG_ERROR, DAEMON_GENERAL_ERROR,
DAEMON_LEGACY_ALREADY_RUNNING, DAEMON_SUCCESS, WORKER_EXIT_ALL_PROCESSES, WORKER_RESTART,
WORKER_SUCCESS,
DAEMON_LEGACY_ALREADY_RUNNING, DAEMON_SUCCESS, WORKER_ERROR_EXIT_NO_CODE,
WORKER_EXIT_ALL_PROCESSES, WORKER_RESTART, WORKER_SUCCESS,
},
ipc::{create_ipc_client_to_worker, IPCEvent},
lock::{acquire_daemon_lock, acquire_legacy_lock, acquire_worker_lock},
@ -271,6 +271,10 @@ fn spawn_worker(
.send(code)
.expect("unable to forward worker exit code");
}
} else {
exit_notify
.send(WORKER_ERROR_EXIT_NO_CODE)
.expect("unable to forward worker exit code");
}
}
})

View File

@ -23,6 +23,7 @@ pub const WORKER_GENERAL_ERROR: i32 = 2;
pub const WORKER_LEGACY_ALREADY_RUNNING: i32 = 3;
pub const WORKER_EXIT_ALL_PROCESSES: i32 = 50;
pub const WORKER_RESTART: i32 = 51;
pub const WORKER_ERROR_EXIT_NO_CODE: i32 = 90;
pub const DAEMON_SUCCESS: i32 = 0;
pub const DAEMON_ALREADY_RUNNING: i32 = 1;