signals.js 1.4 KB

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