inspector: warn when a file shadows node inspect#64448
Closed
bitpshr wants to merge 1 commit into
Closed
Conversation
`node inspect` runs the debugger, but if a file named after the command (for example `inspect.js`) also exists in the current directory, that file is silently not run. Emit a warning in that case so the shadowing is visible, pointing at how to run the file instead. Fixes: nodejs#64111 Signed-off-by: Paul Bouchon <mail@bitpshr.net>
Contributor
|
I really don't think it's worth fixing, there are many other "shadowing" happening (e.g. if you have a file and a directory with the same name, the file shadows the directory and you don't hear anyone complaining about it). It's like a quirk, sure it can be surprising but we don't recommend not providing the file extension, omitting it is asking for trouble |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #64111.
node inspectruns the debugger, so a localinspect.jsgets silently shadowed. This emits a warning when a file named after the command exists in the current directory, pointing at how to run it instead (node ./inspect.js).I went with a warning rather than a hard error, since erroring would break legitimately running the debugger from a directory that happens to contain an
inspect.js. Happy to switch to an error if you'd prefer that.Added a test under
test/parallel.