Closed
Description
I have a script that works with rust-script:
#!/usr/bin/env rust-script
//! ```cargo
//! [dependencies]
//! dummy = { path = "./dummy" }
//! ```
fn main() {
dummy::run();
}
It depends on a local crate in the same directory where the script file lives.
I'd like to run it via a runner like just
. However when run from the runner, the script location is not in the same directory where the the runner recipe lives and thus the dependencies relative paths no longer work.
demo:
#!/usr/bin/env rust-script
//! ```cargo
//! [dependencies]
//! dummy = { path = "./dummy" }
//! ```
fn main() {
dummy::run();
}
$ just demo
error: failed to get `dummy` as a dependency of package `demo v0.1.0 (/Users/mkm/Library/Caches/rust-script/projects/f40865aa4eabcf6c25c2788e)`
Caused by:
failed to load source for dependency `dummy`
Caused by:
Unable to update /var/folders/zp/pk0v2q4x39z43k91vst1_jsc0000gn/T/justzxHC7g/dummy
Caused by:
failed to read `/var/folders/zp/pk0v2q4x39z43k91vst1_jsc0000gn/T/justzxHC7g/dummy/Cargo.toml`
Caused by:
No such file or directory (os error 2)
error: Could not execute cargo
error: Recipe `demo` failed with exit code 1
The runner runs the script with $PWD set to the place I expect it to be, but rust-script (correctly) uses the location of the rust script to find deps.
Is there a trick I can use in order to fool rust-script about its location (fiddling with argv[0] ?)
Or could we add a flag to tell rust-script to use $PWD as base dir for resolving dependencies?
Metadata
Metadata
Assignees
Labels
No labels