[DAEMON-288] SIGINT triggered in core process
|Fix Version/s||Appc Daemon 3.1.0|
DescriptionWhen a process spawns
appcd start, then that process is interrupted via CTRL-C (aka SIGINT), then the core daemon process receives the SIGINT also and shutsdown. The daemon should not be receiving the SIGINT.
- Chris Barber 2019-10-25
SIGINT is propagated to the spawned core process because it's not detached on macOS and Linux.
The core was set to not detach in this commit: https://github.com/appcelerator/appc-daemon/commit/00892d87a78e405c1173a6a2164ea9901b0d9b7b#diff-30dc100d38263dd48fd4dd7ae14e0f3c
This seemingly unknown behavior was actually caused by
// On macOS (and probably Linux), a detached process doesn't stick around to see // if the executable exited with an error, so we must not detach the process, // but rather disconnect it once the daemon is booted. On Windows, we have to // detach it to keep the process running and for some lucky reason, Node sticks // around to see if the executable errors. detached: process.platform === 'win32' ? detached : false,
appcd-nodejsforcing all detached processes to be
unref()'d which in turned caused the child process
"close"event to never be emitted.
- Chris Barber 2019-10-25 PR: https://github.com/appcelerator/appc-daemon/pull/438