chore(shutdown): log CLI kill timeout

Log when Electron/Tauri force-kill the CLI during shutdown so orphaned instance reports are easier to diagnose.
This commit is contained in:
Shantur Rathore
2026-01-25 11:03:16 +00:00
parent c74e0b89f7
commit b83c69f002
2 changed files with 9 additions and 0 deletions

View File

@@ -177,6 +177,9 @@ export class CliProcessManager extends EventEmitter {
return new Promise((resolve) => {
const killTimeout = setTimeout(() => {
console.warn(
`[cli] stop timed out after 30000ms; sending SIGKILL (pid=${child.pid ?? "unknown"})`,
)
child.kill("SIGKILL")
}, 30000)

View File

@@ -278,6 +278,7 @@ impl CliProcessManager {
pub fn stop(&self) -> anyhow::Result<()> {
let mut child_opt = self.child.lock();
if let Some(mut child) = child_opt.take() {
log_line(&format!("stopping CLI pid={}", child.id()));
#[cfg(unix)]
unsafe {
libc::kill(child.id() as i32, libc::SIGTERM);
@@ -293,6 +294,11 @@ impl CliProcessManager {
Ok(Some(_)) => break,
Ok(None) => {
if start.elapsed() > Duration::from_secs(CLI_STOP_GRACE_SECS) {
log_line(&format!(
"stop timed out after {}s; sending SIGKILL pid={}",
CLI_STOP_GRACE_SECS,
child.id()
));
#[cfg(unix)]
unsafe {
libc::kill(child.id() as i32, libc::SIGKILL);