From 7250237b9a9e4cf933fbf034221a836ecc082f15 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 11 Dec 2021 10:03:43 -0700 Subject: [PATCH] pty: actually fix win32 build --- mux/src/localpane.rs | 4 ---- pty/src/lib.rs | 8 ++++---- pty/src/win/mod.rs | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/mux/src/localpane.rs b/mux/src/localpane.rs index 0f95f8671..258222251 100644 --- a/mux/src/localpane.rs +++ b/mux/src/localpane.rs @@ -7,8 +7,6 @@ use anyhow::Error; use async_trait::async_trait; use config::keyassignment::ScrollbackEraseMode; use config::{configuration, ExitBehavior}; -#[cfg(windows)] -use filedescriptor::OwnedHandle; use portable_pty::{Child, ChildKiller, ExitStatus, MasterPty, PtySize}; use rangeset::RangeSet; use smol::channel::{bounded, Receiver, TryRecvError}; @@ -16,8 +14,6 @@ use std::cell::{RefCell, RefMut}; use std::collections::{HashMap, HashSet}; use std::io::Result as IoResult; use std::ops::Range; -#[cfg(windows)] -use std::os::windows::io::{AsRawHandle, RawHandle}; use std::sync::Arc; use termwiz::escape::DeviceControlMode; use termwiz::surface::{Line, SequenceNo, SEQ_ZERO}; diff --git a/pty/src/lib.rs b/pty/src/lib.rs index a7128df51..a96c3f285 100644 --- a/pty/src/lib.rs +++ b/pty/src/lib.rs @@ -49,6 +49,8 @@ use libc; #[cfg(feature = "serde_support")] use serde_derive::*; use std::io::Result as IoResult; +#[cfg(windows)] +use std::os::windows::prelude::{AsRawHandle, RawHandle}; pub mod cmdbuilder; pub use cmdbuilder::CommandBuilder; @@ -242,7 +244,7 @@ impl ChildKiller for ProcessSignaller { fn clone_killer(&self) -> Box { Box::new(Self { pid: self.pid, - handle: self.handle.as_ref().map(|h| h.try_clone().ok()), + handle: self.handle.as_ref().and_then(|h| h.try_clone().ok()), }) } } @@ -301,7 +303,6 @@ impl ChildKiller for std::process::Child { #[cfg(windows)] fn clone_killer(&self) -> Box { - use std::os::windows::prelude::AsRawHandle; struct RawDup(RawHandle); impl AsRawHandle for RawDup { fn as_raw_handle(&self) -> RawHandle { @@ -311,8 +312,7 @@ impl ChildKiller for std::process::Child { Box::new(ProcessSignaller { pid: self.process_id(), - handle: self - .as_raw_handle() + handle: Child::as_raw_handle(self) .as_ref() .and_then(|h| filedescriptor::OwnedHandle::dup(&RawDup(*h)).ok()), }) diff --git a/pty/src/win/mod.rs b/pty/src/win/mod.rs index a24433c20..11bd7debf 100644 --- a/pty/src/win/mod.rs +++ b/pty/src/win/mod.rs @@ -1,4 +1,4 @@ -use crate::{Child, ExitStatus}; +use crate::{Child, ChildKiller, ExitStatus}; use anyhow::Context as _; use std::io::{Error as IoError, Result as IoResult}; use std::os::windows::io::{AsRawHandle, RawHandle};