(exitCode, signal)
| 630 | // represent the exit code and/or signal name of a node process that aborted, |
| 631 | // false otherwise. |
| 632 | function nodeProcessAborted(exitCode, signal) { |
| 633 | // Depending on the compiler used, node will exit with either |
| 634 | // exit code 132 (SIGILL), 133 (SIGTRAP) or 134 (SIGABRT). |
| 635 | let expectedExitCodes = [132, 133, 134]; |
| 636 | |
| 637 | // On platforms using KSH as the default shell (like SmartOS), |
| 638 | // when a process aborts, KSH exits with an exit code that is |
| 639 | // greater than 256, and thus the exit code emitted with the 'exit' |
| 640 | // event is null and the signal is set to either SIGILL, SIGTRAP, |
| 641 | // or SIGABRT (depending on the compiler). |
| 642 | const expectedSignals = ['SIGILL', 'SIGTRAP', 'SIGABRT']; |
| 643 | |
| 644 | // On Windows, 'aborts' are of 2 types, depending on the context: |
| 645 | // (i) Exception breakpoint, if --abort-on-uncaught-exception is on |
| 646 | // which corresponds to exit code 2147483651 (0x80000003) |
| 647 | // (ii) Otherwise, _exit(134) which is called in place of abort() due to |
| 648 | // raising SIGABRT exiting with ambiguous exit code '3' by default |
| 649 | if (isWindows) |
| 650 | expectedExitCodes = [0x80000003, 134]; |
| 651 | |
| 652 | // When using --abort-on-uncaught-exception, V8 will use |
| 653 | // base::OS::Abort to terminate the process. |
| 654 | // Depending on the compiler used, the shell or other aspects of |
| 655 | // the platform used to build the node binary, this will actually |
| 656 | // make V8 exit by aborting or by raising a signal. In any case, |
| 657 | // one of them (exit code or signal) needs to be set to one of |
| 658 | // the expected exit codes or signals. |
| 659 | if (signal !== null) { |
| 660 | return expectedSignals.includes(signal); |
| 661 | } |
| 662 | return expectedExitCodes.includes(exitCode); |
| 663 | } |
| 664 | |
| 665 | function isAlive(pid) { |
| 666 | try { |
no test coverage detected
searching dependent graphs…