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
How often does it reproduce? Is there a required condition?
Happens always.
What is the expected behavior? Why is that the expected behavior?
Node should not try to read the env file and the test script should print
works
when passing a script argument --env-file.
What do you see instead?
Node tries to read the env file and, for example, returns the following for nonexistent files:
node: nonexistent-file: not found
Additional information
To me, it looks like that the function Dotenv::GetPathFromArgs is missing a break from the while loop when it encounters a non-option commandline argument (the script path) or the argument separator --.
The text was updated successfully, but these errors were encountered:
Version
v22.5.1 / v20.16.0
Platform
No response
Subsystem
No response
What steps will reproduce the bug?
A script argument named the same as the node option
--env-file
is detected as option by node.According to node's
--help
output, node options should be specified before the script path (or the argument separator--
):Executing a given test script
works.js
with content:works fine when called with a script argument which uses the same name as a node option, for example
--help
. The commandsnode -e 'console.log("works");' -- --help node works.js --help
correctly print
instead of node's
--help
output.However, if the script argument is named
--env-file
, the commandsnode -e 'console.log("works");' -- --env-file nonexistent-file node works.js --env-file nonexistent-file
print this instead:
How often does it reproduce? Is there a required condition?
Happens always.
What is the expected behavior? Why is that the expected behavior?
Node should not try to read the env file and the test script should print
when passing a script argument
--env-file
.What do you see instead?
Node tries to read the env file and, for example, returns the following for nonexistent files:
Additional information
To me, it looks like that the function Dotenv::GetPathFromArgs is missing a break from the while loop when it encounters a non-option commandline argument (the script path) or the argument separator
--
.The text was updated successfully, but these errors were encountered: