1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 05:12:40 +03:00

pty: actually fix win32 build

This commit is contained in:
Wez Furlong 2021-12-11 10:03:43 -07:00
parent bf34be3ab8
commit 7250237b9a
3 changed files with 5 additions and 9 deletions

View File

@ -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};

View File

@ -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<dyn ChildKiller + Send + Sync> {
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<dyn ChildKiller + Send + Sync> {
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()),
})

View File

@ -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};