use std::{os::unix::process::CommandExt, process::Command};
use nix::unistd;
use tokio::signal::unix::{SignalKind, signal};
pub async fn wait_reload() {
let mut stream = signal(SignalKind::hangup()).expect("Failed to create SIGHUP signal stream");
stream.recv().await;
}
pub fn process_detach(command: &mut Command) {
unsafe {
command.pre_exec(move || {
if unistd::setsid().is_err() {
std::process::exit(1);
}
Ok(())
});
}
}