SIGINT (Ctrl+C) and SIGTERM are not handled
See original GitHub issueWhen executing this file with c8 I get the coverage information.
function run() {
if (1) {
console.log(1);
} else {
console.log(2);
}
}
run();
setTimeout(process.exit, 3000)
However if I kill the process using Ctrl+C before the timeout, I don’t get the coverage information for the code executed until that point.
Use case: I launch a service as a separate process and then launch integration tests (by sending requests to the service). Then I kill the service and check the coverage to make the tests pass. istanbul and nyc handle process kill correctly.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Is it possible to capture a Ctrl+C signal (SIGINT) and run a ...
Process.Signal(syscall.SIGTERM) or other signals are not supported on Windows. I handled this problem by creating a temp file as a signal.
Read more >SIGINT (Ctrl-C) or SIGTERM (Ctrl-Break) as the *actually ...
Hey Brad,. Let me clarify the difference in behavior. When an agent exits, it can do so “gracefully” or not. A graceful leave...
Read more >Handling Signals: Function signal()
The above program has two identical loops. However, before the first loop starts, signal SIGINT is ignored and, as a result, hitting Ctrl-C...
Read more >Handling Interrupt Signals - ZeroMQ [Book] - O'Reilly
Realistic applications need to shut down cleanly when interrupted with Ctrl-C or another signal, such as SIGTERM . By default, these simply kill...
Read more >SIGINT And Other Termination Signals in Linux - Baeldung
SIGINT is the signal sent when we press Ctrl+C. The default action is to terminate the process. However, some programs override this action...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I created an issue for node: https://github.com/nodejs/node/issues/35212
Should c8 attach an event handler for SIGINT/SIGTERM etc. in the meantime ?
@bcoe @zbjornson Seems to be a node problem: