diff --git a/crates/action-pipeline/src/action_runner.rs b/crates/action-pipeline/src/action_runner.rs index ac7f1a41ef..8dd9a1119d 100644 --- a/crates/action-pipeline/src/action_runner.rs +++ b/crates/action-pipeline/src/action_runner.rs @@ -184,8 +184,6 @@ pub async fn run_action( ) .await; - dbg!(&result); - emitter .emit(Event::TaskRan { error: extract_error(&result), diff --git a/crates/process/src/shared_child.rs b/crates/process/src/shared_child.rs index 833c34dcdf..c391a95806 100644 --- a/crates/process/src/shared_child.rs +++ b/crates/process/src/shared_child.rs @@ -10,7 +10,7 @@ pub struct SharedChild { inner: Arc>, pid: u32, #[cfg(windows)] - handle: std::os::windows::io::RawHandle, + handle: RawHandle, } impl SharedChild { @@ -26,8 +26,8 @@ impl SharedChild { pub fn new(child: Child) -> Self { Self { pid: child.id().unwrap(), + handle: RawHandle(child.raw_handle().unwrap()), inner: Arc::new(Mutex::new(child)), - handle: child.raw_handle().unwrap(), } } @@ -55,7 +55,11 @@ impl SharedChild { Ok(()) } - pub async fn kill_with_signal(&self, signal: SignalType) -> io::Result<()> { + pub async fn kill_with_signal( + &self, + #[cfg(unix)] signal: SignalType, + #[cfg(windows)] _signal: SignalType, + ) -> io::Result<()> { // https://github.com/rust-lang/rust/blob/master/library/std/src/sys/pal/unix/process/process_unix.rs#L940 #[cfg(unix)] { diff --git a/crates/process/src/signal.rs b/crates/process/src/signal.rs index 48533591e6..17a53550a2 100644 --- a/crates/process/src/signal.rs +++ b/crates/process/src/signal.rs @@ -58,8 +58,6 @@ mod unix { if result != 0 { let error = io::Error::last_os_error(); - dbg!(result, &error); - // "No such process" error, so it may have been killed already // https://man7.org/linux/man-pages/man3/errno.3.html if error.raw_os_error().is_some_and(|code| code == 3) { @@ -87,6 +85,12 @@ mod windows { fn TerminateProcess(hProcess: *mut c_void, uExitCode: c_uint) -> c_int; } + #[derive(Clone)] + struct RawHandle(*mut c_void); + + unsafe impl Send for RawHandle {} + unsafe impl Sync for RawHandle {} + pub async fn wait_for_signal(sender: Sender) { use tokio::signal::windows; @@ -117,8 +121,8 @@ mod windows { }; } - pub fn terminate(handle: *mut c_void) -> io::Result<()> { - if unsafe { TerminateProcess(handle, 1) } == 0 { + pub fn terminate(handle: RawHandle) -> io::Result<()> { + if unsafe { TerminateProcess(handle.0, 1) } == 0 { Err(io::Error::last_os_error()) } else { Ok(())