diff --git a/theseus/src/launcher/mod.rs b/theseus/src/launcher/mod.rs index 2e35fc08..1b914f35 100644 --- a/theseus/src/launcher/mod.rs +++ b/theseus/src/launcher/mod.rs @@ -232,11 +232,12 @@ pub async fn launch_minecraft( .collect::>(), ) .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 +}