1
0

Windows fix process env vars (#96)

* fixes windows issue

* clippy
This commit is contained in:
Wyatt Verchere
2023-04-23 10:38:04 -07:00
committed by GitHub
parent 16f297b546
commit 79ef48549f

View File

@@ -232,11 +232,12 @@ pub async fn launch_minecraft(
.collect::<Vec<_>>(),
)
.current_dir(instance_path.clone())
.env_clear()
.envs(env_args)
.stdout(Stdio::piped())
.stderr(Stdio::piped());
// Clear cargo-added env varaibles for debugging, and add settings env vars
clear_cargo_env_vals(&mut command).envs(env_args);
// Create Minecraft child by inserting it into the state
// This also spawns the process and prepares the subsequent processes
let mut state_children = state.children.write().await;
@@ -249,3 +250,12 @@ pub async fn launch_minecraft(
)
.await
}
fn clear_cargo_env_vals(command: &mut Command) -> &mut Command {
for (key, _) in std::env::vars() {
if key.starts_with("CARGO") {
command.env_remove(key);
}
}
command
}