- added running game process checking timeout
This commit is contained in:
Observer KRypt0n_ 2023-03-02 22:29:37 +02:00
parent 420326a8a0
commit 77f7e77aa2
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
2 changed files with 5 additions and 1 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "anime-launcher-sdk" name = "anime-launcher-sdk"
version = "0.2.0" version = "0.2.1"
authors = ["Nikita Podvirnyy <suimin.tu.mu.ga.mi@gmail.com>"] authors = ["Nikita Podvirnyy <suimin.tu.mu.ga.mi@gmail.com>"]
license = "GPL-3.0" license = "GPL-3.0"
readme = "README.md" readme = "README.md"

View file

@ -161,12 +161,16 @@ pub fn run() -> anyhow::Result<()> {
#[allow(unused_must_use)] #[allow(unused_must_use)]
std::thread::spawn(move || { 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() { while let Ok(output) = Command::new("ps").arg("-A").stdout(Stdio::piped()).output() {
let output = String::from_utf8_lossy(&output.stdout); let output = String::from_utf8_lossy(&output.stdout);
if !output.contains("GenshinImpact.e") && !output.contains("unlocker.exe") { if !output.contains("GenshinImpact.e") && !output.contains("unlocker.exe") {
break; break;
} }
std::thread::sleep(std::time::Duration::from_secs(3));
} }
rpc.update(RpcUpdates::Disconnect); rpc.update(RpcUpdates::Disconnect);