Allow `Ctrl+C` to stop the target process and generate flamegraph from collected data
Hello 👋
Thanks for the great project — it has already been very helpful!
In my case, I’m profiling a long-running script (which can hang or take several hours to complete), and I would like to profile it without modifying the code at all — a "zero-modification" profiling workflow.
I'm running:
npx 0x ./node_modules/.bin/mocha es6/test.js
The script starts fine, and I see:
🔥 Profiling
New test
🔥 Waiting for subprocess to exit...
🔥 Force closing subprocess...
🔥 Closing subprocess is taking a long time, it might have hung. Press Ctrl+C again to force close
After a few minutes, I hit Ctrl+C, hoping this would:
- stop the
mochasubprocess, - and generate the flamegraph from whatever profiling data had been recorded so far.
However, this doesn’t seem to work: either the process hangs, or the flamegraph isn’t produced.
It would be great if 0x could:
- respond to
Ctrl+Cby terminating the subprocess, - and still generate a flamegraph from the collected data.
This would really help in cases where the script doesn’t exit cleanly or is stuck at 100% CPU.
Thanks again for your work!
It worked in this way prior to latest node.js releases. I guess something has changed. A PR would be amazing.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.