From f1e75caf895781ae872bc7173f96916b078f20e1 Mon Sep 17 00:00:00 2001 From: Arijit Basu Date: Wed, 28 Jul 2021 11:27:09 +0530 Subject: [PATCH] Remove termion dependency Termion is only used to get TTY which is simple enough to implement. --- Cargo.lock | 28 ---------------------------- Cargo.toml | 1 - src/runner.rs | 16 ++++++++-------- 3 files changed, 8 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dce7363..f2853cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -570,12 +570,6 @@ dependencies = [ "libc", ] -[[package]] -name = "numtoa" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" - [[package]] name = "oorandom" version = "11.1.3" @@ -719,15 +713,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "redox_termios" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" -dependencies = [ - "redox_syscall", -] - [[package]] name = "redox_users" version = "0.4.0" @@ -897,18 +882,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "termion" -version = "1.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" -dependencies = [ - "libc", - "numtoa", - "redox_syscall", - "redox_termios", -] - [[package]] name = "textwrap" version = "0.11.0" @@ -1133,7 +1106,6 @@ dependencies = [ "natord", "serde", "serde_yaml", - "termion", "tui", ] diff --git a/Cargo.toml b/Cargo.toml index 8398ff7..2ba7c23 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,6 @@ name = "xplr" [dependencies] tui = { version = "0.15.0", default-features = false, features = ['crossterm', 'serde'] } -termion = "1.5.6" crossterm = "0.19.0" dirs = "3.0.2" serde = { version = "1.0.126", features = ["derive"] } diff --git a/src/runner.rs b/src/runner.rs index be690a0..f8aa98a 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -18,15 +18,21 @@ use std::io::Write; use std::path::PathBuf; use std::process::{Command, ExitStatus, Stdio}; use std::sync::mpsc; -use termion::get_tty; use tui::backend::CrosstermBackend; use tui::Terminal; +fn get_tty() -> io::Result { + fs::OpenOptions::new() + .read(true) + .write(true) + .open("/dev/tty") +} + fn call_lua( app: &app::App, lua: &mlua::Lua, func: &str, - silent: bool, + _silent: bool, ) -> Result>> { let _focus_index = app .directory_buffer() @@ -34,12 +40,6 @@ fn call_lua( .unwrap_or_default() .to_string(); - let (_, _, _) = if silent { - (Stdio::null(), Stdio::null(), Stdio::null()) - } else { - (get_tty()?.into(), get_tty()?.into(), get_tty()?.into()) - }; - let arg = app.to_lua_arg(); let arg = lua.to_value(&arg)?; lua::call(lua, func, arg)