-
Notifications
You must be signed in to change notification settings - Fork 31k
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
Specify working directory for node --run
#57489
Comments
cc @anonrig |
@flakey5 ... any suggestions on what the flag should look like? I've never been a big fan of Also, this is definitely worthwhile I think. While I'm sure @anonrig can do it, I'd also encourage you to take a stab at it. The changes necessary are fairly straightforward. |
I.e. // node --working-directory=/etc/123 main.js
process.cwd() // = /etc/123 |
I can also take a swing at this if @JonasBa isn't interested |
I'd just don't add working-directory to argument parser, and just parse it inside node run file implementation. If we have other implementation that uses working-directory then we can add it to arg parser. |
Go for it :-) |
I think just --working-directory would be confusing unless it sets the working directory for the entire process, including fs apis. If the impact of the flag is just for the run command then its name should reflect that. |
What is the problem this feature will solve?
Currently
node --run
doesn't allow you to specify the working directory to run the command in. This is needed for things like running the new api docs tooling (re #57343)What is the feature you are proposing to solve the problem?
Something similar to npm's
--prefix
flag (i.e.npx --prefix <working dir> ...
ornpm --prefix <working dir> ...
)What alternatives have you considered?
No response
The text was updated successfully, but these errors were encountered: