From 5ad2b73092ca2169b02c3f8134ac7328c339f37d Mon Sep 17 00:00:00 2001 From: daa Date: Tue, 10 Apr 2018 21:34:13 +0300 Subject: [PATCH] Fix windows build --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4ef92b1..1835ff6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -367,6 +367,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "nvim-gtk" version = "0.2.0" dependencies = [ + "atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "cairo-rs 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "gdk 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -379,7 +380,6 @@ dependencies = [ "gtk-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "neovim-lib 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "pango 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 787059f..f9c34be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ serde_derive = "1.0" toml = "0.4" serde_json = "1.0" -libc = "0.2" +atty = "0.2" #[dependencies.neovim-lib] #git = "https://github.com/daa84/neovim-lib" diff --git a/src/main.rs b/src/main.rs index 84f6836..902bae8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,7 +28,7 @@ extern crate rmpv; extern crate unicode_segmentation; extern crate unicode_width; -extern crate libc; +extern crate atty; extern crate serde; #[macro_use] extern crate serde_derive; @@ -175,9 +175,7 @@ where } fn read_piped_input() -> Option { - let isatty = unsafe { libc::isatty(libc::STDIN_FILENO) != 0 }; - - if !isatty { + if atty::isnt(atty::Stream::Stdin) { let mut buf = String::new(); match std::io::stdin().read_to_string(&mut buf) { Ok(_) => Some(buf),