diff --git a/noxis-rs/src/utils/prcs.rs b/noxis-rs/src/utils/prcs.rs index 4747204..01e292e 100644 --- a/noxis-rs/src/utils/prcs.rs +++ b/noxis-rs/src/utils/prcs.rs @@ -29,15 +29,7 @@ pub mod v2 { fn new() -> Self { Pid(0) } - fn new_from_output(pid: Option) -> Self { - let temp = { - match pid { - Some(pid) => String::from_utf8_lossy(pid.stdout.trim_ascii()).into_owned(), - None => return Pid(0), - } - }; - Pid(temp.parse::().unwrap_or_else(|_| { 0 })) - } + #[allow(unused)] pub fn new_sysinfo_pid(&self) -> sysinfo::Pid { sysinfo::Pid::from_u32(self.0 as u32) } @@ -77,6 +69,7 @@ pub mod v2 { self.bin = bin.as_ref().to_string_lossy().into_owned(); self } + #[allow(unused)] pub fn get_pid(&self) -> Pid { self.pid } @@ -158,28 +151,33 @@ pub mod v2 { } tokio::time::sleep(Duration::from_micros(100)).await; } + #[allow(unused)] pub async fn stop_by_user_call(&mut self) -> anyhow::Result<()> { terminate_process(&self.name).await?; self.state = ProcessState::StoppedByCli; self.pid = Pid::new(); Ok(()) } + #[allow(unused)] pub async fn freeze_by_user_call(&mut self) -> anyhow::Result<()> { freeze_process(&self.name).await?; self.state = ProcessState::HoldingByCli; Ok(()) } + #[allow(unused)] pub async fn start_by_user_call(&mut self) -> anyhow::Result<()> { let pid = start_process(&self.name, &self.bin).await?; self.state = ProcessState::Pending; self.pid = Pid(pid); Ok(()) } + #[allow(unused)] pub async fn unfreeze_by_user_call(&mut self) -> anyhow::Result<()> { unfreeze_process(&self.name).await?; self.state = ProcessState::Pending; Ok(()) } + #[allow(unused)] pub async fn restart_by_user_call(&mut self) -> anyhow::Result<()> { let pid = restart_process(&self.name, &self.bin).await?; self.pid = Pid(pid);