-
Notifications
You must be signed in to change notification settings - Fork 29.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debug: node.js does not terminate when debugging simple script #5831
Comments
This was like this since the beggining of time - I also see it in stable. |
@isidorn Surely this hasn't been like this forever. If a program is done, it's done, and the debugger used to quit debugging. Now I just think the program is still alive when it isn't. It's especially bad if you are debugging a node server which crashes. The debugger shows the user that it is still running but you cannot hit it with the web browser... |
@joaomoreno I remember this was like this since at least 6 months, but I think since day 1. This is how node behaves @weinand can correct me here |
No it's not. Node stops executing when there is nothing more to execute; it continues executing otherwise (e.g. when a If a script contains console.log('goodbye') What you get by running |
@joaomoreno what you describe is the 'happy path' (non debug) mode of node.js. Please run your one line snippet from above in debug mode from the command line:
and then attach node-inspector and run the program to the end. You will find that the node process does not exit. So @isidorn is right: this has been like this forever. Your statement from above 'It's especially bad if you are debugging a node server which crashes....' is unfounded because node server crashes are not affected by node running in debug mode. |
I have to disagree, that behaviour just appears to be a bug that no one cares. A bit of searching yielded nodejs/node#1788 which they seem to be picking up soon. It's a bug since 0.12; version 0.10 actually behaves as I and Ben expect it to. Since this is a bug in Node itself I propose to just close this issue. |
Node team has replaced the debugging engine and even though the same behavior is observed they are encouraging more digging into the VSCode side. Is it possible to re-open this for more research? Actual behavior Expected behavior Steps to reproduce
OS: Ubuntu 17.10 & MacOS Sierra |
The VS Code node debugger ends the debug session on receipt of a terminate event from the runtime. @roblourens do you receive a terminate event with the inspector protocol? |
This is fixed in 1.14 - microsoft/vscode-node-debug2#11 |
@roblourens we should mention in the release notes that this long-standing node.js bug has been finally fixed and that this will show up for the inspector protocol. |
I have a very simple index.js file with a "console.log()" statement and run it via debugger. The debugger does not terminate though, but keeps running. I would expect the debugger to stop after the console.log.
@weinand @isidorn fyi
The text was updated successfully, but these errors were encountered: