diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rs index 1b5e739928b8d19f96258cc4de4f5cd1ce099f51..842b0d6f53dc893d24435d83fbf5fc67a3b7951d 100644 --- a/crates/gpui/src/platform/linux/platform.rs +++ b/crates/gpui/src/platform/linux/platform.rs @@ -150,12 +150,22 @@ impl Platform for P { } }; - // script to wait for the current process to exit and then restart the app + log::info!("Restarting process, using app path: {:?}", app_path); + + // Script to wait for the current process to exit and then restart the app. + // We also wait for possibly open TCP sockets by the process to be closed, + // since on Linux it's not guaranteed that a process' resources have been + // cleaned up when `kill -0` returns. let script = format!( r#" while kill -O {pid} 2>/dev/null; do sleep 0.1 done + + while lsof -nP -iTCP -a -p {pid} 2>/dev/null; do + sleep 0.1 + done + {app_path} "#, pid = app_pid,