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