Skip to content
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

--env-file reads commented-out lines of file! #662

Closed
4 of 6 tasks
zsiegel92 opened this issue Oct 7, 2024 · 1 comment
Closed
4 of 6 tasks

--env-file reads commented-out lines of file! #662

zsiegel92 opened this issue Oct 7, 2024 · 1 comment
Labels
bug Something isn't working pending triage

Comments

@zsiegel92
Copy link

Acknowledgements

  • I read the documentation and searched existing issues to avoid duplicates
  • I understand this is a bug tracker and anything other than a proven bug will be closed
  • I understand this is a free project and relies on community contributions
  • I read and understood the Contribution guide

Minimal reproduction URL

https://github.com/zsiegel92/tsx_env_var_bug_mwe

Problem & expected behavior (under 200 words)

The .env file in the MWE repo looks like this:

ENV_VAR=right # comment after
# ENV_VAR=wrong

Using npx tsx --env-file .env test.ts, the commented-out wrong variable is set during execution rather than the correct one. The conditions for this are:

  • the correct one has a comment after the line where it's defined
  • the wrong one appears below the right one

Bugs are expected to be fixed by those affected by it

  • I'm interested in working on this issue

Compensating engineering work will speed up resolution and support the project

  • I'm willing to offer $10 for financial support
@zsiegel92 zsiegel92 added bug Something isn't working pending triage labels Oct 7, 2024
@privatenumber
Copy link
Owner

This is not a tsx bug—it doesn't implement this feature. All unrecognized flags are just relayed to the underlying node command to handle.

I also can't reproduce with the latest Node:

$ tsx --env-file=.env ./test.ts
right
$ node -v
v22.9.0

But you're likely encountering nodejs/node#52084

@privatenumber privatenumber closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending triage
Projects
None yet
Development

No branches or pull requests

2 participants