Skip to content

Commit 2c9e337

Browse files
ysm-devBrendonovich
authored andcommitted
fix(desktop): avoid sidecar health-check timeout on shell startup (anomalyco#13925)
Co-authored-by: Brendan Allan <[email protected]>
1 parent 1774312 commit 2c9e337

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • packages/desktop/src-tauri/src

packages/desktop/src-tauri/src/cli.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ pub fn spawn_command(
308308
};
309309

310310
let mut cmd = Command::new(shell);
311-
cmd.args(["-il", "-c", &line]);
311+
cmd.args(["-l", "-c", &line]);
312312

313313
for (key, value) in envs {
314314
cmd.env(key, value);
@@ -363,6 +363,7 @@ pub fn spawn_command(
363363
}
364364

365365
tokio::spawn(async move {
366+
let mut kill_open = true;
366367
let status = loop {
367368
match child.try_wait() {
368369
Ok(Some(status)) => break Ok(status),
@@ -371,8 +372,11 @@ pub fn spawn_command(
371372
}
372373

373374
tokio::select! {
374-
_ = kill_rx.recv() => {
375-
let _ = child.start_kill();
375+
msg = kill_rx.recv(), if kill_open => {
376+
if msg.is_some() {
377+
let _ = child.start_kill();
378+
}
379+
kill_open = false;
376380
}
377381
_ = tokio::time::sleep(Duration::from_millis(100)) => {}
378382
}

0 commit comments

Comments
 (0)