pub fn terminate(&self) -> ProcessResult<()> {
        let result = unsafe {
            processthreadsapi::TerminateProcess(
                *self.handle,
                // This is going to be the code with which the process will exit
                libc::SIGTERM as u32,
            )
        };
        // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-terminateprocess

        if result == 0 {
            match Error::last_os_error().with_ffi("TerminateProcess") {
                // TODO: `psutil` ignores permission errors and considers the target process
                // to be dead already.
                // See: https://github.com/giampaolo/psutil/issues/1099
                // It seems kinda shady, so the behavior should be checked.
                e if e.raw_os_error() == Some(winerror::ERROR_ACCESS_DENIED as i32) => Ok(()),
                e => Err(e.into()),
            }
        } else {
            Ok(())
        }
    }
/// ERROR_INVALID_PARAMETER should be considered as a `NoSuchProcess` later
ERROR_INVALID_PARAMETER should be considered as a `NoSuchProcess` later
ERROR_INVALID_PARAMETER should be considered as a ` NoSuchProcess ` later
pub fn terminate(&self) -> ProcessResult<()> {
        let result = unsafe {
            processthreadsapi::TerminateProcess(
                *self.handle,
                // This is going to be the code with which the process will exit
                libc::SIGTERM as u32,
            )
        };
        // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-terminateprocess
        if result == 0 {
            match Error::last_os_error().with_ffi("TerminateProcess") {
                // TODO: `psutil` ignores permission errors and considers the target process
                // to be dead already.
                // See: https://github.com/giampaolo/psutil/issues/1099
                // It seems kinda shady, so the behavior should be checked.
                e if e.raw_os_error() == Some(winerror::ERROR_ACCESS_DENIED as i32) => Ok(()),
                e => Err(e.into()),
            }
        } else {
            Ok(())
        }
    }
pub fn terminate ( & self ) -> ProcessResult < ( ) > { let result = unsafe { processthreadsapi :: TerminateProcess ( * self . handle , // This is going to be the code with which the process will exit libc :: SIGTERM as u32 , ) } ; // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-terminateprocess if result == 0 { match Error :: last_os_error ( ) . with_ffi ( " " ) { // TODO: `psutil` ignores permission errors and considers the target process // to be dead already. // See: https://github.com/giampaolo/psutil/issues/1099 // It seems kinda shady, so the behavior should be checked. e if e . raw_os_error ( ) == Some ( winerror :: ERROR_ACCESS_DENIED as i32 ) => Ok ( ( ) ) , e => Err ( e . into ( ) ) , } } else { Ok ( ( ) ) } }
ERROR_INVALID_PARAMETER should be considered as a `NoSuchProcess` later
ERROR_INVALID_PARAMETER should be considered as a ` NoSuchProcess ` later
&self
&self