Tuesday, 27 July 2021

is there a way to print the stacktrace of the current JS line when I ctrl+c in terminal?

I want my javascript to print a stack trace when I force close, so that I know where a function is hanging for instance. Is there a way to do this? I run the code with Node, specifically npx ts-node code.ts. I imagine hijacking sigint might work, but then the console.trace would be from the sigint block and not the original code -- I am stuck making progress here.



from is there a way to print the stacktrace of the current JS line when I ctrl+c in terminal?

No comments:

Post a Comment