Skip to content

Commit

Permalink
Restore Deref implementation for ProcessHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
acj committed Feb 6, 2024
1 parent fe93cee commit 29c269f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ mod platform {
use std::convert::TryFrom;
use std::io;
use std::mem;
use std::ops::Deref;
use std::os::raw::c_void;
use std::os::windows::io::{AsRawHandle, RawHandle};
use std::process::Child;
Expand All @@ -406,6 +407,14 @@ mod platform {
#[derive(Clone, Eq, PartialEq, Hash)]
pub struct ProcessHandle(Arc<ProcessHandleInner>);

impl Deref for ProcessHandle {
type Target = HANDLE;

fn deref(&self) -> &Self::Target {
&self.0 .0
}
}

impl Drop for ProcessHandleInner {
fn drop(&mut self) {
unsafe { CloseHandle(self.0) };
Expand Down

0 comments on commit 29c269f

Please sign in to comment.