Set an environment variable during serve for bundling

This commit is contained in:
Evan Almloff 2023-08-18 11:12:56 -05:00
parent efe08df966
commit 1ed814668a
2 changed files with 5 additions and 2 deletions

View file

@ -240,7 +240,10 @@ pub fn start_desktop(config: &CrateConfig) -> Result<(Child, BuildResult)> {
if cfg!(windows) {
file.set_extension("exe");
}
let child = Command::new(file.to_str().unwrap()).spawn()?;
let active = "DIOXUS_ACTIVE";
let child = Command::new(file.to_str().unwrap())
.env(active, "true")
.spawn()?;
Ok((child, result))
}

View file

@ -158,7 +158,7 @@ fn get_asset_root() -> Option<PathBuf> {
*/
if std::env::var_os("CARGO").is_some() {
if std::env::var_os("CARGO").is_some() || std::env::var_os("DIOXUS_ACTIVE").is_some() {
return None;
}