From e1bd06bda568753fe180746c0ab137b99e2c38c4 Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Fri, 30 May 2025 22:22:43 +0200 Subject: [PATCH] unset CARGO_MANIFEST_DIR, don't set it to empty string (#4225) * tie rust backtrace to verbosity to tracing * dont panic --- packages/cli/src/build/builder.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/build/builder.rs b/packages/cli/src/build/builder.rs index 42b706fc5..bbf56b0b2 100644 --- a/packages/cli/src/build/builder.rs +++ b/packages/cli/src/build/builder.rs @@ -453,12 +453,16 @@ impl AppBuilder { dioxus_cli_config::ALWAYS_ON_TOP_ENV, always_on_top.to_string(), ), - // unset the cargo dirs in the event we're running `dx` locally - // since the child process will inherit the env vars, we don't want to confuse the downstream process - ("CARGO_MANIFEST_DIR", "".to_string()), - ("RUST_BACKTRACE", "1".to_string()), ]; + if crate::VERBOSITY + .get() + .map(|f| f.verbose) + .unwrap_or_default() + { + envs.push(("RUST_BACKTRACE", "1".to_string())); + } + if let Some(base_path) = krate.base_path() { envs.push((dioxus_cli_config::ASSET_ROOT_ENV, base_path.to_string())); } @@ -734,6 +738,7 @@ impl AppBuilder { let mut child = Command::new(main_exe) .envs(envs) + .env_remove("CARGO_MANIFEST_DIR") // running under `dx` shouldn't expose cargo-only : .stderr(Stdio::piped()) .stdout(Stdio::piped()) .kill_on_drop(true) @@ -796,6 +801,7 @@ impl AppBuilder { .arg("booted") .arg(self.build.bundle_identifier()) .envs(ios_envs) + .env_remove("CARGO_MANIFEST_DIR") .stderr(Stdio::piped()) .stdout(Stdio::piped()) .kill_on_drop(true)