diff --git a/docs/cli/commands.json b/docs/cli/commands.json index 00792b7..f00fb84 100644 --- a/docs/cli/commands.json +++ b/docs/cli/commands.json @@ -663,7 +663,9 @@ "subcommand_required": true, "help": "Start, stop, and check the status of the pitchfork supervisor daemon", "name": "supervisor", - "aliases": [], + "aliases": [ + "sup" + ], "hidden_aliases": [], "examples": [] }, diff --git a/docs/cli/supervisor.md b/docs/cli/supervisor.md index 952a35c..189273d 100644 --- a/docs/cli/supervisor.md +++ b/docs/cli/supervisor.md @@ -1,6 +1,7 @@ # `pitchfork supervisor` - **Usage**: `pitchfork supervisor ` +- **Aliases**: `sup` Start, stop, and check the status of the pitchfork supervisor daemon diff --git a/pitchfork.usage.kdl b/pitchfork.usage.kdl index 35027e5..76a78d9 100644 --- a/pitchfork.usage.kdl +++ b/pitchfork.usage.kdl @@ -83,6 +83,7 @@ cmd "stop" help="Sends a stop signal to a daemon" { arg "[ID]..." help="The name of the daemon to stop" var=true } cmd "supervisor" subcommand_required=true help="Start, stop, and check the status of the pitchfork supervisor daemon" { + alias "sup" cmd "run" help="Runs the internal pitchfork daemon in the foreground" { flag "-f --force" help="kill existing daemon" } diff --git a/src/cli/supervisor/mod.rs b/src/cli/supervisor/mod.rs index 15de312..d17cdd6 100644 --- a/src/cli/supervisor/mod.rs +++ b/src/cli/supervisor/mod.rs @@ -8,6 +8,7 @@ mod stop; /// Start, stop, and check the status of the pitchfork supervisor daemon #[derive(Debug, clap::Args)] +#[clap(visible_alias = "sup", verbatim_doc_comment)] pub struct Supervisor { #[clap(subcommand)] command: Commands, diff --git a/src/procs.rs b/src/procs.rs index 2c2285d..6479087 100644 --- a/src/procs.rs +++ b/src/procs.rs @@ -51,6 +51,7 @@ impl Procs { .unwrap() .process(sysinfo::Pid::from_u32(pid)) { + debug!("killing process {}", pid); #[cfg(windows)] process.kill(); #[cfg(unix)] diff --git a/src/supervisor.rs b/src/supervisor.rs index 400f440..539bafc 100644 --- a/src/supervisor.rs +++ b/src/supervisor.rs @@ -257,7 +257,9 @@ impl Supervisor { async fn stop(&self, id: &str) -> Result { info!("stopping daemon: {id}"); if let Some(daemon) = self.get_daemon(id).await { + trace!("daemon to stop: {daemon}"); if let Some(pid) = daemon.pid { + trace!("killing pid: {pid}"); PROCS.refresh_processes(); if PROCS.is_running(pid) { self.upsert_daemon(UpsertDaemonOpts { @@ -267,9 +269,15 @@ impl Supervisor { }) .await?; PROCS.kill_async(pid).await?; + } else { + debug!("pid {pid} not running"); } return Ok(IpcResponse::Ok); + } else { + debug!("daemon {id} not running"); } + } else { + debug!("daemon {id} not found"); } Ok(IpcResponse::DaemonAlreadyStopped) }