From 77f7e77aa222fcde9264a0df06f7588fa62df219 Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Thu, 2 Mar 2023 22:29:37 +0200 Subject: [PATCH] 0.2.1 - added running game process checking timeout --- Cargo.toml | 2 +- src/game.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index e6575b4..5c09b12 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "anime-launcher-sdk" -version = "0.2.0" +version = "0.2.1" authors = ["Nikita Podvirnyy "] license = "GPL-3.0" readme = "README.md" diff --git a/src/game.rs b/src/game.rs index 83b95de..67fdc83 100644 --- a/src/game.rs +++ b/src/game.rs @@ -161,12 +161,16 @@ pub fn run() -> anyhow::Result<()> { #[allow(unused_must_use)] std::thread::spawn(move || { + std::thread::sleep(std::time::Duration::from_secs(3)); + while let Ok(output) = Command::new("ps").arg("-A").stdout(Stdio::piped()).output() { let output = String::from_utf8_lossy(&output.stdout); if !output.contains("GenshinImpact.e") && !output.contains("unlocker.exe") { break; } + + std::thread::sleep(std::time::Duration::from_secs(3)); } rpc.update(RpcUpdates::Disconnect);