storkit: merge 452_bug_claude_code_pty_crashes_with_fatal_runtime_error_on_agent_restart
This commit is contained in:
@@ -38,6 +38,9 @@ regex = { workspace = true }
|
||||
libsqlite3-sys = { version = "0.35.0", features = ["bundled"] }
|
||||
wait-timeout = "0.2.1"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
libc = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = { workspace = true }
|
||||
tokio-tungstenite = { workspace = true }
|
||||
|
||||
@@ -124,6 +124,19 @@ fn resolve_path_arg(path_str: Option<&str>, cwd: &std::path::Path) -> Option<Pat
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), std::io::Error> {
|
||||
// Reap zombie grandchildren on Unix (for native deployments without tini/init).
|
||||
// Docker containers with `init: true` in docker-compose.yml already have tini
|
||||
// as PID 1 for this. For native macOS/Linux, poll waitpid(-1, WNOHANG) in a
|
||||
// background thread so orphaned grandchildren don't accumulate as zombies.
|
||||
#[cfg(unix)]
|
||||
std::thread::spawn(|| loop {
|
||||
// SAFETY: waitpid(-1, ...) with WNOHANG is always safe to call.
|
||||
unsafe {
|
||||
while libc::waitpid(-1, std::ptr::null_mut(), libc::WNOHANG) > 0 {}
|
||||
}
|
||||
std::thread::sleep(std::time::Duration::from_secs(5));
|
||||
});
|
||||
|
||||
let app_state = Arc::new(SessionState::default());
|
||||
let cwd = std::env::current_dir().unwrap_or_else(|_| PathBuf::from("."));
|
||||
let store = Arc::new(
|
||||
|
||||
Reference in New Issue
Block a user