1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 13:52:55 +03:00

move pty to its own crate in preparation for publishing

Refs: https://github.com/wez/wezterm/issues/27
This commit is contained in:
Wez Furlong 2019-05-19 18:38:59 -07:00
parent c207142bcf
commit 7bf1d99d77
16 changed files with 51 additions and 17 deletions

View File

@ -30,6 +30,7 @@ leb128 = "0.2"
libc = "0.2"
open = "1.2"
palette = "0.4"
portable-pty = { path = "pty", features = ["serde_support"]}
promise = { path = "promise" }
rayon = "1.0"
serde = {version="1.0", features = ["rc"]}

33
pty/Cargo.toml Normal file
View File

@ -0,0 +1,33 @@
[package]
name = "portable-pty"
version = "0.1.0"
authors = ["Wez Furlong"]
edition = "2018"
repository = "https://github.com/wez/wezterm"
description = "Cross platform pty interface"
license = "MIT"
documentation = "https://docs.rs/portable-pty"
[dependencies]
failure = "0.1"
failure_derive = "0.1"
libc = "0.2"
serde_derive = {version="1.0", optional=true}
serde = {version="1.0", optional=true}
[features]
default = []
serde_support = ["serde", "serde_derive"]
[target."cfg(windows)".dependencies]
shared_library = "0.1"
uds_windows = "0.1"
winapi = { version = "0.3", features = [
"winuser",
"consoleapi",
"handleapi",
"fileapi",
"namedpipeapi",
"synchapi",
]}

View File

@ -1,4 +1,5 @@
use failure::Error;
use failure::{bail, format_err, Error};
#[cfg(feature = "serde_support")]
use serde_derive::*;
use std::io::Result as IoResult;
@ -83,7 +84,8 @@ impl Child for std::process::Child {
}
#[allow(dead_code)]
#[derive(Debug, Clone, Copy, Deserialize)]
#[derive(Debug, Clone, Copy)]
#[cfg_attr(feature = "serde_support", derive(Deserialize))]
pub enum PtySystemSelection {
Unix,
ConPty,

View File

@ -1,7 +1,7 @@
//! Working with pseudo-terminals
use crate::pty::{Child, CommandBuilder, MasterPty, PtySize, PtySystem, SlavePty};
use failure::Error;
use crate::{Child, CommandBuilder, MasterPty, PtySize, PtySystem, SlavePty};
use failure::{bail, Error};
use libc::{self, winsize};
use std::io;
use std::mem;

View File

@ -1,7 +1,7 @@
use super::ownedhandle::OwnedHandle;
use super::WinChild;
use crate::pty::cmdbuilder::CommandBuilder;
use crate::pty::{Child, MasterPty, PtySize, PtySystem, SlavePty};
use crate::cmdbuilder::CommandBuilder;
use crate::{Child, MasterPty, PtySize, PtySystem, SlavePty};
use failure::Error;
use lazy_static::lazy_static;
use shared_library::shared_library;

View File

@ -1,4 +1,4 @@
use crate::pty::{Child, ExitStatus};
use crate::{Child, ExitStatus};
use std::io::{Error as IoError, Result as IoResult};
use winapi::shared::minwindef::DWORD;
use winapi::um::minwinbase::STILL_ACTIVE;

View File

@ -1,7 +1,7 @@
use super::ownedhandle::OwnedHandle;
use super::WinChild;
use crate::pty::cmdbuilder::CommandBuilder;
use crate::pty::{Child, MasterPty, PtySize, PtySystem, SlavePty};
use crate::cmdbuilder::CommandBuilder;
use crate::{Child, MasterPty, PtySize, PtySystem, SlavePty};
use failure::Error;
use safe::{AgentFlags, MouseMode, SpawnConfig, SpawnFlags, Timeout, WinPty, WinPtyConfig};
use std::ffi::OsString;

View File

@ -3,7 +3,7 @@
//! https://github.com/rprichard/winpty/blob/master/src/include/winpty.h
#![allow(dead_code)]
use super::sys::*;
use crate::pty::win::ownedhandle::OwnedHandle;
use crate::win::ownedhandle::OwnedHandle;
use bitflags::bitflags;
use failure::{format_err, Error};
use std::ffi::{OsStr, OsString};

View File

@ -3,10 +3,9 @@
use crate::font::FontSystemSelection;
use crate::frontend::FrontEndSelection;
use crate::get_shell;
use crate::pty::CommandBuilder;
use crate::pty::PtySystemSelection;
use failure::{err_msg, Error};
use lazy_static::lazy_static;
use portable_pty::{CommandBuilder, PtySystemSelection};
use serde_derive::*;
use std;
use std::ffi::OsStr;

View File

@ -1,7 +1,7 @@
use crate::mux::renderable::Renderable;
use crate::mux::tab::{alloc_tab_id, Tab, TabId};
use crate::pty::{Child, MasterPty, PtySize};
use failure::Error;
use portable_pty::{Child, MasterPty, PtySize};
use std::cell::{RefCell, RefMut};
use term::{KeyCode, KeyModifiers, MouseEvent, Terminal, TerminalHost};

View File

@ -6,9 +6,9 @@ use crate::mux::window::WindowId;
use crate::mux::Mux;
use crate::opengl::render::Renderer;
use crate::opengl::textureatlas::OutOfTextureSpace;
use crate::pty::{PtySize, PtySystemSelection};
use failure::Error;
use glium;
use portable_pty::{PtySize, PtySystemSelection};
use std::rc::Rc;
use std::sync::Arc;

View File

@ -27,8 +27,7 @@ use crate::mux::Mux;
mod font;
use crate::font::{FontConfiguration, FontSystemSelection};
mod pty;
use pty::PtySize;
use portable_pty::PtySize;
use std::env;
/// Determine which shell to run.

View File

@ -1,6 +1,6 @@
use crate::config::Config;
use crate::pty::ExitStatus;
use failure::Error;
use portable_pty::ExitStatus;
use promise::{Executor, Future};
use std::cell::{Ref, RefCell, RefMut};
use std::collections::HashMap;