No Description

signals.js 1.3KB

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. //
  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. if (process.platform !== 'win32') {
  29. module.exports.push(
  30. 'SIGVTALRM',
  31. 'SIGXCPU',
  32. 'SIGXFSZ',
  33. 'SIGUSR2',
  34. 'SIGTRAP',
  35. 'SIGSYS',
  36. 'SIGQUIT',
  37. 'SIGIOT'
  38. // should detect profiler and enable/disable accordingly.
  39. // see #21
  40. // 'SIGPROF'
  41. )
  42. }
  43. if (process.platform === 'linux') {
  44. module.exports.push(
  45. 'SIGIO',
  46. 'SIGPOLL',
  47. 'SIGPWR',
  48. 'SIGSTKFLT',
  49. 'SIGUNUSED'
  50. )
  51. }