builder: retain Cargo config for run and correct acceptance checks

This commit is contained in:
2026-11-07 14:20:37 +00:00
parent e53211eff1
commit 7ee4059414
3 changed files with 19 additions and 13 deletions
+11 -7
View File
@@ -123,12 +123,15 @@ impl Builder {
b"Signature: 8a477f597d28d172789f06886806bc55\n",
)?;
std::fs::write(base.join("last-used"), [])?;
let cwd = source.join(
world_cwd
.strip_prefix(&workspace)
.expect("workspace is an ancestor of cwd")
.trim_start_matches('/'),
);
let relative = world_cwd
.strip_prefix(&workspace)
.expect("workspace is an ancestor of cwd")
.trim_start_matches('/');
let cwd = if relative.is_empty() {
source.clone()
} else {
source.join(relative)
};
let mut fetch = Command::new("cargo");
if action == "add" {
fetch.args(&request.argv).arg("--dry-run");
@@ -274,7 +277,6 @@ impl Builder {
}
}
let split = args.iter().position(|a| a == "--").unwrap_or(args.len());
cmd.args(&args[..split]);
if action == "run" {
cmd.arg("--config").arg(format!(
"target.wasm32-wasip2.runner=[{:?},{:?}]",
@@ -282,6 +284,8 @@ impl Builder {
tools.join("run.nu")
));
}
// Keep all global config flags before the subcommand so Cargo retains them.
cmd.args(&args[..split]);
if compiles {
cmd.args([
"--target",