Skip to content
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

"restart" for request type "launch" does a re-run instead of a re-attach #24278

Closed
weinand opened this issue Apr 7, 2017 · 2 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@weinand
Copy link
Contributor

weinand commented Apr 7, 2017

while testing the MERN tour #22277:

A "restart" in a launch config of request type "launch" does not only "re-attach" to node but runs the program again. This doesn't make much sense if the "program" is still running, like e.g. "nodemon".

So on every edit of "test.js" VS Code launches the program "nodemon" again:

nodemon --debug=5858 test.js
nodemon --debug=5858 test.js
nodemon --debug=5858 test.js
nodemon --debug=5858 test.js
...

What should happen is the following:

nodemon --debug=5858 test.js
attach 5858
attach 5858
attach 5858
...
@weinand weinand self-assigned this Apr 7, 2017
@weinand weinand added debug Debug viewlet, configurations, breakpoints, adapter issues bug Issue identified by VS Code Team member as probable bug labels Apr 7, 2017
@weinand weinand added this to the April 2017 milestone Apr 7, 2017
@weinand
Copy link
Contributor Author

weinand commented Apr 25, 2017

Since VS Code knows nothing about the "restart" attribute of a node launch-config I had to fix this problem in node-debug:

  • when VS Code receives a "restart" flag in the terminate event, it will "restart" the session by sending a "launchRequest" to the DAP (this is the existing behaviour). To let the DAP know that this is the result of a "restart", an additional attribute "__restart" is added to the launchRequest argument (this experimental attribute has been added for this milestone).
  • whenever "node-debug" receives a "__restart" attribute with value "true" it does not launch the program again but attaches to the debug port specified in the launchRequest argument.

/cc @roblourens

@weinand
Copy link
Contributor Author

weinand commented Apr 25, 2017

To verify, just create a program "app.js" with this contents:

var i = 0;
setInterval(() => {
	console.log('hello world:' + i++);
}, 1000);

Create a launch config from the Intellisense snippet "Nodemon Setup".

Whenever you edit app.js VS Code should re-attach to the new node process but no longer launch "nodemon" again.

Please note: this has been only fixed for "protocol": "legacy".

@weinand weinand added the verification-needed Verification of issue is requested label Apr 25, 2017
@isidorn isidorn added the verified Verification succeeded label Apr 26, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

2 participants