You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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 node --eval and node --print when no arguments are specified to .parse(). To avoid breaking existing code or getting weird test results with custom argv depending on how node is launched, { from: 'node' } still assumes "normal" node conventions.
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: