signals.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. module.exports = [
  17. 'SIGABRT',
  18. 'SIGALRM',
  19. 'SIGBUS',
  20. 'SIGFPE',
  21. 'SIGHUP',
  22. 'SIGILL',
  23. 'SIGINT',
  24. 'SIGSEGV',
  25. 'SIGTERM'
  26. ]
  27. if (process.platform !== 'win32') {
  28. module.exports.push(
  29. 'SIGVTALRM',
  30. 'SIGXCPU',
  31. 'SIGXFSZ',
  32. 'SIGUSR2',
  33. 'SIGTRAP',
  34. 'SIGSYS',
  35. 'SIGQUIT',
  36. 'SIGIOT'
  37. // should detect profiler and enable/disable accordingly.
  38. // see #21
  39. // 'SIGPROF'
  40. )
  41. }
  42. if (process.platform === 'linux') {
  43. module.exports.push(
  44. 'SIGIO',
  45. 'SIGPOLL',
  46. 'SIGPWR',
  47. 'SIGSTKFLT',
  48. 'SIGUNUSED'
  49. )
  50. }