fix(desktop): avoid sidecar health-check timeout on shell startup (#13925)

Co-authored-by: Brendan Allan <brendonovich@outlook.com>
This commit is contained in:
Chris Yang
2026-02-18 00:34:16 +09:00
committed by GitHub
parent adfbfe350d
commit d055c1cad6

View File

@@ -308,7 +308,7 @@ pub fn spawn_command(
}; };
let mut cmd = Command::new(shell); let mut cmd = Command::new(shell);
cmd.args(["-il", "-c", &line]); cmd.args(["-l", "-c", &line]);
for (key, value) in envs { for (key, value) in envs {
cmd.env(key, value); cmd.env(key, value);
@@ -363,6 +363,7 @@ pub fn spawn_command(
} }
tokio::spawn(async move { tokio::spawn(async move {
let mut kill_open = true;
let status = loop { let status = loop {
match child.try_wait() { match child.try_wait() {
Ok(Some(status)) => break Ok(status), Ok(Some(status)) => break Ok(status),
@@ -371,8 +372,11 @@ pub fn spawn_command(
} }
tokio::select! { tokio::select! {
_ = kill_rx.recv() => { msg = kill_rx.recv(), if kill_open => {
let _ = child.start_kill(); if msg.is_some() {
let _ = child.start_kill();
}
kill_open = false;
} }
_ = tokio::time::sleep(Duration::from_millis(100)) => {} _ = tokio::time::sleep(Duration::from_millis(100)) => {}
} }