stop tunnel when executable gets deleted (#181505)

stop when executable gets deleted
This commit is contained in:
Martin Aeschlimann
2023-05-09 09:25:51 +02:00
committed by GitHub
parent 3d3e22e21d
commit 0c85b95c48
3 changed files with 31 additions and 13 deletions

View File

@@ -52,3 +52,10 @@ pub fn find_running_process(name: &Path) -> Option<u32> {
}
None
}
pub async fn wait_until_exe_deleted(current_exe: &Path, poll_ms: u64) {
let duration = Duration::from_millis(poll_ms);
while current_exe.exists() {
tokio::time::sleep(duration).await;
}
}