Skip to content

Commit 09b4142

Browse files
committed
Use host target directory when calling host cargo.
When using docker, the target directory is mounted at `/target`. However, when falling back to the host cargo, if we provide a custom target directory, we incorrectly pass it as `--target-dir /target`. To rectify this, this PR passes the original command-line arguments to cargo. Fixes #619.
1 parent 0adbce2 commit 09b4142

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
55

66
## [Unreleased]
77

8+
- #714 - use host target directory when falling back to host cargo.
89
- #713 - convert relative target directories to absolute paths.
910
- #709 - Update Emscripten targets to `emcc` version 3.1.10
1011
- #707, #708 - Set `BINDGEN_EXTRA_CLANG_ARGS` environment variable to pass sysroot to `rust-bindgen`

src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,12 @@ fn run() -> Result<ExitStatus> {
410410
}
411411

412412
eprintln!("Warning: Falling back to `cargo` on the host.");
413-
cargo::run(&args.all, verbose)
413+
414+
// fix for #619: other subcommands have the wrong target dir here.
415+
// in the docker host, the target directory is mounted as /target.
416+
// if we fallback to the host cargo, need to use the original path.
417+
let argv: Vec<String> = env::args().skip(1).collect();
418+
cargo::run(&argv, verbose)
414419
}
415420

416421
#[derive(PartialEq, Debug)]

0 commit comments

Comments
 (0)