diff --git a/plugins/shell/src/commands.rs b/plugins/shell/src/commands.rs index ed043813..771788b0 100644 --- a/plugins/shell/src/commands.rs +++ b/plugins/shell/src/commands.rs @@ -13,11 +13,10 @@ use tauri::{ use crate::{ open::Program, - process::{CommandEvent, TerminatedPayload}, + process::{CommandEvent, ExitStatus, TerminatedPayload}, scope::ExecuteArgs, Shell, }; -use std::process::ExitStatus; type ChildId = u32; @@ -304,14 +303,13 @@ pub fn kill( } #[tauri::command] -pub fn wait( +pub async fn wait( _window: Window, shell: State<'_, Shell>, pid: ChildId, ) -> crate::Result { if let Some(child) = shell.children.lock().unwrap().get(&pid) { - let exitstatus: ExitStatus = child.wait()?; - Ok(exitstatus) + child.wait().await } else { Err(crate::Error::UnknowChildProcess) } diff --git a/plugins/shell/src/process/mod.rs b/plugins/shell/src/process/mod.rs index 376eadc4..c0cc6d1e 100644 --- a/plugins/shell/src/process/mod.rs +++ b/plugins/shell/src/process/mod.rs @@ -86,9 +86,11 @@ impl CommandChild { } /// Waits for the child to exit completely, returning the status that it exited with. - pub fn wait(self) -> crate::Result { + pub async fn wait(self) -> crate::Result { let exitstatus = self.inner.wait()?; - Ok(exitstatus) + Ok(ExitStatus { + code: exitstatus.code(), + }) } }