1 | // This is not the set of all possible signals.
|
2 | //
|
3 | // It IS, however, the set of all signals that trigger
|
4 | // an exit on either Linux or BSD systems. Linux is a
|
5 | // superset of the signal names supported on BSD, and
|
6 | // the unknown signals just fail to register, so we can
|
7 | // catch that easily enough.
|
8 | //
|
9 | // Don't bother with SIGKILL. It's uncatchable, which
|
10 | // means that we can't fire any callbacks anyway.
|
11 | //
|
12 | // If a user does happen to register a handler on a non-
|
13 | // fatal signal like SIGWINCH or something, and then
|
14 | // exit, it'll end up firing `process.emit('exit')`, so
|
15 | // the handler will be fired anyway.
|
16 | //
|
17 | // SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
18 | // artificially, inherently leave the process in a
|
19 | // state from which it is not safe to try and enter JS
|
20 | // listeners.
|
21 | module.exports = [
|
22 | 'SIGABRT',
|
23 | 'SIGALRM',
|
24 | 'SIGHUP',
|
25 | 'SIGINT',
|
26 | 'SIGTERM'
|
27 | ]
|
28 |
|
29 | if (process.platform !== 'win32') {
|
30 | module.exports.push(
|
31 | 'SIGVTALRM',
|
32 | 'SIGXCPU',
|
33 | 'SIGXFSZ',
|
34 | 'SIGUSR2',
|
35 | 'SIGTRAP',
|
36 | 'SIGSYS',
|
37 | 'SIGQUIT',
|
38 | 'SIGIOT'
|
39 | // should detect profiler and enable/disable accordingly.
|
40 | // see #21
|
41 | // 'SIGPROF'
|
42 | )
|
43 | }
|
44 |
|
45 | if (process.platform === 'linux') {
|
46 | module.exports.push(
|
47 | 'SIGIO',
|
48 | 'SIGPOLL',
|
49 | 'SIGPWR',
|
50 | 'SIGSTKFLT',
|
51 | 'SIGUNUSED'
|
52 | )
|
53 | }
|