-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Handle the case when node called with the "-e" argument #2163
Comments
For interest, did you encounter this lack in use or noticed in code? Yes, this is a case we could handle. I wrote code for this in |
I ran into this when I changed the way I called a script (running in a docker instance) from another app. It took a bit of investigation to figure out what caused the problem as node is not my main development environment and I'd say, this definitely is a surprising behavior. Knowing what the problem is, the workaround is 2 lines of code but, I think, it's better to take care of it in a higher-level library, like this. |
I have opened a PR which will autodetect (And updated documentation to match.) |
Released in v12.1.0 |
When you call node with the -e argument and supply the script (commands) to execute on the command line then the script parameter will be missing from process.argv (at index 1) so automatic parsing (
{from: 'node'}
) will fail.As far as I can see this case can be handled by looking into
process.execArgv
and checking for the presence of the-e
or--eval
option.(One might use this option to run non-trivial scripts e.g. when calling a node process in a docker container.)
The text was updated successfully, but these errors were encountered: