builder: retain Cargo config for run and correct acceptance checks
This commit is contained in:
+11
-7
@@ -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",
|
||||
|
||||
@@ -49,7 +49,7 @@ impl WasiHttpHooks for Hooks {
|
||||
if request.method() == http::Method::POST && request.uri().path() == "/cargo" {
|
||||
return Ok((
|
||||
crate::api::stream(&router, request),
|
||||
Box::new(async { Ok(()) }),
|
||||
Box::new(async { Ok(()) }) as Io,
|
||||
));
|
||||
}
|
||||
return Ok(response(crate::api::handle(&router, caller, request).await));
|
||||
|
||||
Reference in New Issue
Block a user