signals.js 1.5 KB

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