-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add flag that set working directory for cargo run
#10974
Comments
In addition to the above, cargo will run the executable from wherever cargo is run from. If it is outside of your project directory, you can pass I'm going to close with the same reasoning from #9864 (comment), which lists several other workarounds. |
If the user wants the equivalent of As for the config file discovery issue itself, I think we should continue to scrutinize the use cases that require config files. If there are common tasks that are not environment-specific, those should likely be pushed to |
Problem
Today I found myself needing to run
cargo run
in a directory separated from the Rust project. If I attemptcd $target_dir && cargo run
, it would only emit an error for missingCargo.toml
. The only way to do it was to add$project/target/debug
to$PATH
but it would come with its own set of inconveniences.Proposed Solution
Implement a flag named
--work-dir <DIR>
(or whatever name you may find more intuitive and conventional) tocargo run
to let user set working directory for the binary before run.Notes
No response
The text was updated successfully, but these errors were encountered: