I have a very cpu-intensive application. I wonder if it's possible to get the current stack trace in order to understand, via SIGINT termination, for example, in which specific function is the current computation.
I tried adding the following handler:
process.on('SIGINT', function() {
log('SIGINT!')
var stack = new Error().stack;
log( stack );
log('quitting.');
process.exit();
});
but it seems that it's called only when the intensive computation is ended and not immediately as I press Ctrl-C.
any idea on how to follow the execution without polluting the code with log messages?