config + stop outsourcing other commands

This commit is contained in:
lda committed 2026-04-11 17:36:53 +07:00
1 parent fec10a61d4
commit ce1c0c0558
11 files changed
+160 -30

No files matched your search

+14 -8
View File
@@ -105,13 +105,19 @@ fn read_pid(path: &Path) -> Result<i32> {
}
fn send_hup(pid: i32) -> Result<()> {
let status = std::process::Command::new("kill")
.arg("-HUP")
.arg(pid.to_string())
.status()
.context("failed to invoke kill -HUP")?;
if !status.success() {
anyhow::bail!("kill -HUP failed for pid {pid}");
#[cfg(unix)]
{
use nix::sys::signal::{Signal, kill};
use nix::unistd::Pid;
kill(Pid::from_raw(pid), Signal::SIGHUP)
.with_context(|| format!("failed to send SIGHUP to pid {pid}"))?;
Ok(())
}
#[cfg(not(unix))]
{
let _ = pid;
anyhow::bail!("reload is only supported on Unix (SIGHUP unavailable on this platform)")
}
Ok(())
}