Skip to content

Commit

Permalink
Fix remaining warnings
Browse files Browse the repository at this point in the history
-Rename child to _child for non Unix systems
-Run cargo fmt on the source code
  • Loading branch information
Refragg committed Aug 19, 2023
1 parent da0986d commit 9ace7f8
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,30 +620,32 @@ unsafe extern "C" fn start_game_clicked(

let mut process = Command::new(state.game_path.clone());

let child = process.spawn();
let _child = process.spawn();

#[cfg(unix)]
{
// For Unix systems only, spawn a new thread that waits for the process to exit.
// This avoids keeping the process in a zombie state and never letting go of it until
// the plugin is unloaded
let mut child = match child {
Ok(child) => { child }

let mut child = match _child {
Ok(child) => child,
Err(e) => {
warn!("Failure starting the game process {e}");
return false;
}
};

std::thread::spawn(move || {
match child.wait() {
Ok(exit_status) => { info!("Game process exited with {}", exit_status); }
Err(e) => { warn!("Failure waiting for the game process' exit: {e}"); }

std::thread::spawn(move || match child.wait() {
Ok(exit_status) => {
info!("Game process exited with {}", exit_status);
}
Err(e) => {
warn!("Failure waiting for the game process' exit: {e}");
}
});
}

return false;
}

Expand Down

0 comments on commit 9ace7f8

Please sign in to comment.