mirror of
https://github.com/wez/wezterm.git
synced 2024-12-25 06:12:16 +03:00
more explicit dyn for windows
This commit is contained in:
parent
8e38f34b6d
commit
190303c7d5
@ -208,7 +208,7 @@ impl PtySystemSelection {
|
|||||||
/// Construct an instance of PtySystem described by the enum value.
|
/// Construct an instance of PtySystem described by the enum value.
|
||||||
/// Windows specific enum variants result in an error.
|
/// Windows specific enum variants result in an error.
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub fn get(self) -> Result<Box<dyn PtySystem>, Error> {
|
pub fn get(self) -> Fallible<Box<dyn PtySystem>> {
|
||||||
match self {
|
match self {
|
||||||
PtySystemSelection::Unix => Ok(Box::new(unix::UnixPtySystem {})),
|
PtySystemSelection::Unix => Ok(Box::new(unix::UnixPtySystem {})),
|
||||||
_ => bail!("{:?} not available on unix", self),
|
_ => bail!("{:?} not available on unix", self),
|
||||||
@ -218,7 +218,7 @@ impl PtySystemSelection {
|
|||||||
/// Construct an instance of PtySystem described by the enum value.
|
/// Construct an instance of PtySystem described by the enum value.
|
||||||
/// Unix specific enum variants result in an error.
|
/// Unix specific enum variants result in an error.
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
pub fn get(&self) -> Result<Box<PtySystem>, Error> {
|
pub fn get(&self) -> Fallible<Box<dyn PtySystem>> {
|
||||||
match self {
|
match self {
|
||||||
PtySystemSelection::ConPty => Ok(Box::new(win::conpty::ConPtySystem {})),
|
PtySystemSelection::ConPty => Ok(Box::new(win::conpty::ConPtySystem {})),
|
||||||
PtySystemSelection::WinPty => Ok(Box::new(win::winpty::WinPtySystem {})),
|
PtySystemSelection::WinPty => Ok(Box::new(win::winpty::WinPtySystem {})),
|
||||||
|
@ -224,7 +224,7 @@ pub struct ConPtySlavePty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl MasterPty for ConPtyMasterPty {
|
impl MasterPty for ConPtyMasterPty {
|
||||||
fn resize(&self, size: PtySize) -> Result<(), Error> {
|
fn resize(&self, size: PtySize) -> Fallible<()> {
|
||||||
let mut inner = self.inner.lock().unwrap();
|
let mut inner = self.inner.lock().unwrap();
|
||||||
inner.resize(size.rows, size.cols, size.pixel_width, size.pixel_height)
|
inner.resize(size.rows, size.cols, size.pixel_width, size.pixel_height)
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ impl MasterPty for ConPtyMasterPty {
|
|||||||
Ok(inner.size.clone())
|
Ok(inner.size.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_clone_reader(&self) -> Result<Box<std::io::Read + Send>, Error> {
|
fn try_clone_reader(&self) -> Fallible<Box<dyn std::io::Read + Send>> {
|
||||||
Ok(Box::new(self.inner.lock().unwrap().readable.try_clone()?))
|
Ok(Box::new(self.inner.lock().unwrap().readable.try_clone()?))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -249,7 +249,7 @@ impl io::Write for ConPtyMasterPty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl SlavePty for ConPtySlavePty {
|
impl SlavePty for ConPtySlavePty {
|
||||||
fn spawn_command(&self, cmd: CommandBuilder) -> Result<Box<Child>, Error> {
|
fn spawn_command(&self, cmd: CommandBuilder) -> Fallible<Box<dyn Child>> {
|
||||||
let inner = self.inner.lock().unwrap();
|
let inner = self.inner.lock().unwrap();
|
||||||
|
|
||||||
let mut si: STARTUPINFOEXW = unsafe { mem::zeroed() };
|
let mut si: STARTUPINFOEXW = unsafe { mem::zeroed() };
|
||||||
|
@ -4,7 +4,7 @@ use crate::win::winpty::safe::{
|
|||||||
AgentFlags, MouseMode, SpawnConfig, SpawnFlags, Timeout, WinPty, WinPtyConfig,
|
AgentFlags, MouseMode, SpawnConfig, SpawnFlags, Timeout, WinPty, WinPtyConfig,
|
||||||
};
|
};
|
||||||
use crate::{Child, MasterPty, PtyPair, PtySize, PtySystem, SlavePty};
|
use crate::{Child, MasterPty, PtyPair, PtySize, PtySystem, SlavePty};
|
||||||
use failure::{bail, Error, Fallible};
|
use failure::{bail, Fallible};
|
||||||
use filedescriptor::FileDescriptor;
|
use filedescriptor::FileDescriptor;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
@ -32,7 +32,7 @@ pub struct WinPtySlavePty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl MasterPty for WinPtyMasterPty {
|
impl MasterPty for WinPtyMasterPty {
|
||||||
fn resize(&self, size: PtySize) -> Result<(), Error> {
|
fn resize(&self, size: PtySize) -> Fallible<()> {
|
||||||
let mut inner = self.inner.lock().unwrap();
|
let mut inner = self.inner.lock().unwrap();
|
||||||
if inner.pty.set_size(size.cols as i32, size.rows as i32)? {
|
if inner.pty.set_size(size.cols as i32, size.rows as i32)? {
|
||||||
inner.size = size;
|
inner.size = size;
|
||||||
@ -42,11 +42,11 @@ impl MasterPty for WinPtyMasterPty {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_size(&self) -> Result<PtySize, Error> {
|
fn get_size(&self) -> Fallible<PtySize> {
|
||||||
Ok(self.inner.lock().unwrap().size)
|
Ok(self.inner.lock().unwrap().size)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_clone_reader(&self) -> Result<Box<std::io::Read + Send>, Error> {
|
fn try_clone_reader(&self) -> Fallible<Box<dyn std::io::Read + Send>> {
|
||||||
Ok(Box::new(self.inner.lock().unwrap().reader.try_clone()?))
|
Ok(Box::new(self.inner.lock().unwrap().reader.try_clone()?))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ impl std::io::Write for WinPtyMasterPty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl SlavePty for WinPtySlavePty {
|
impl SlavePty for WinPtySlavePty {
|
||||||
fn spawn_command(&self, cmd: CommandBuilder) -> Result<Box<Child>, Error> {
|
fn spawn_command(&self, cmd: CommandBuilder) -> Fallible<Box<dyn Child>> {
|
||||||
let (exe, cmdline) = cmd.cmdline()?;
|
let (exe, cmdline) = cmd.cmdline()?;
|
||||||
let cmd_os = OsString::from_wide(&cmdline);
|
let cmd_os = OsString::from_wide(&cmdline);
|
||||||
debug!(
|
debug!(
|
||||||
|
Loading…
Reference in New Issue
Block a user