fix: stop_running function

Use stop_running to set the global is_running AtomicBool to false, and to also, on a seperate thread, enable & then disable mouse capture, as was experience strange issue on Linux & WSL with mouse movements being piped to stdout
This commit is contained in:
Jack Wills
2023-02-28 18:10:24 +00:00
parent 31bfaa7a95
commit 2626250ace
3 changed files with 31 additions and 37 deletions
+2 -6
View File
@@ -20,6 +20,7 @@ use crate::{
app_data::{AppData, ContainerId, DockerControls},
app_error::AppError,
parse_args::CliArgs,
stop_running,
ui::{GuiState, Status},
ENTRY_POINT,
};
@@ -408,12 +409,7 @@ impl DockerData {
.values()
.into_iter()
.for_each(tokio::task::JoinHandle::abort);
// This is a fix for a weird bug on Linux + WSL which will output mouse movement to the stdout
// execute!(std::io::stdout(), DisableMouseCapture).unwrap_or(());
std::thread::spawn(||{
execute!(std::io::stdout(), DisableMouseCapture).unwrap_or(());
});
self.is_running.store(false, Ordering::SeqCst);
stop_running(&self.is_running);
}
}
}