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

src: check if the script file exists before starting inspector #42673

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Copy link
Contributor

@cola119 cola119 commented Apr 9, 2022

Fixed #42600

Currently node --inspect-brk index.js will start the inspector and wait a connection event though index.js doesn't exist. And immediately after connected, node will throw Cannot find module error and wait to be disconnected.

This PR added the ability to check for the existence of the script file before an inspector agent is started. If the script is missing, inspector is not enabled and node module loader will throw MODULE_NOT_FUOND error.

v17.9.0 This PR
node --inspect no-exist.js Enable inspector agent & MODULE_NOT_FOUND error MODULE_NOT_FOUND error
node --inspect-brk no-exist.js Enable inspector agent MODULE_NOT_FOUND error
node inspect no-exist.js Enable inspector agent but commands fail MODULE_NOT_FOUND error in a child process
node --inspect Enable inspector agent Enable inspector agent
node --inspect-brk Enable inspector agent Enable inspector agent

@nodejs-github-bot
Copy link

@nodejs-github-bot nodejs-github-bot commented Apr 9, 2022

Review requested:

@nodejs-github-bot nodejs-github-bot added c++ lib / src needs-ci labels Apr 9, 2022
@cola119 cola119 marked this pull request as draft Apr 9, 2022
@cola119 cola119 marked this pull request as ready for review Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ lib / src needs-ci
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants