Skip to content

src: check if the script file exists before starting inspector

Rodrigo Muino Tomonari requested to merge github/fork/cola119/issue/42600 into main

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

Merge request reports

Loading