Skip to content

Commit

Permalink
Use built-in is_terminal instead of is_terminal::is_terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
nibon7 committed Jul 14, 2023
1 parent 786ba3b commit 55dc194
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 13 deletions.
4 changes: 0 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ nix = { version = "0.26", default-features = false, features = [
"fs",
"term",
] }
is-terminal = "0.4.8"

[dev-dependencies]
nu-test-support = { path = "./crates/nu-test-support", version = "0.82.1" }
Expand Down
1 change: 0 additions & 1 deletion crates/nu-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ crossterm = "0.26"
fancy-regex = "0.11"
fuzzy-matcher = "0.3"
is_executable = "1.0"
is-terminal = "0.4.8"
log = "0.4"
miette = { version = "5.9", features = ["fancy-no-backtrace"] }
once_cell = "1.18"
Expand Down
3 changes: 1 addition & 2 deletions crates/nu-cli/src/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::{
NuHighlighter, NuValidator, NushellPrompt,
};
use crossterm::cursor::SetCursorStyle;
use is_terminal::IsTerminal;
use log::{trace, warn};
use miette::{ErrReport, IntoDiagnostic, Result};
use nu_cmd_base::util::get_guaranteed_cwd;
Expand All @@ -26,7 +25,7 @@ use reedline::{
SqliteBackedHistory, Vi,
};
use std::{
io::{self, Write},
io::{self, IsTerminal, Write},
path::Path,
sync::atomic::Ordering,
time::Instant,
Expand Down
1 change: 0 additions & 1 deletion crates/nu-command/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ htmlescape = "0.3"
indexmap = "2.0"
indicatif = "0.17"
is-root = "0.1"
is-terminal = "0.4.8"
itertools = "0.10"
log = "0.4"
lscolors = { version = "0.14", default-features = false, features = ["nu-ansi-term"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/nu-command/src/viewers/table.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use is_terminal::IsTerminal;
use lscolors::{LsColors, Style};
use nu_color_config::color_from_hex;
use nu_color_config::{StyleComputer, TextStyle};
Expand All @@ -14,6 +13,7 @@ use nu_table::{
TableConfig, TableOutput, TableTheme,
};
use nu_utils::get_ls_colors;
use std::io::IsTerminal;
use std::sync::Arc;
use std::time::Instant;
use std::{path::PathBuf, sync::atomic::AtomicBool};
Expand Down
1 change: 0 additions & 1 deletion crates/nu-system/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ log = "0.4"

[target.'cfg(target_family = "unix")'.dependencies]
nix = { version = "0.26", default-features = false, features = ["fs", "term", "process", "signal"]}
is-terminal = "0.4.8"

[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
procfs = "0.15"
Expand Down
2 changes: 1 addition & 1 deletion crates/nu-system/src/foreground.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ impl Drop for ForegroundChild {
// Note: we exclude macos because the techniques below seem to have issues in macos 13 currently.
#[cfg(all(target_family = "unix", not(target_os = "macos")))]
mod fg_process_setup {
use is_terminal::IsTerminal;
use nix::{
sys::signal,
unistd::{self, Pid},
};
use std::io::IsTerminal;

Check failure on line 89 in crates/nu-system/src/foreground.rs

View workflow job for this annotation

GitHub Actions / std-lib-and-python-virtualenv (ubuntu-20.04, py)

use of unstable library feature 'is_terminal'

Check failure on line 89 in crates/nu-system/src/foreground.rs

View workflow job for this annotation

GitHub Actions / fmt-clippy (ubuntu-20.04, default)

use of unstable library feature 'is_terminal'

Check failure on line 89 in crates/nu-system/src/foreground.rs

View workflow job for this annotation

GitHub Actions / fmt-clippy (ubuntu-20.04, dataframe)

use of unstable library feature 'is_terminal'

Check failure on line 89 in crates/nu-system/src/foreground.rs

View workflow job for this annotation

GitHub Actions / fmt-clippy (ubuntu-20.04, extra)

use of unstable library feature 'is_terminal'

Check failure on line 89 in crates/nu-system/src/foreground.rs

View workflow job for this annotation

GitHub Actions / tests (ubuntu-20.04, default)

use of unstable library feature 'is_terminal'

Check failure on line 89 in crates/nu-system/src/foreground.rs

View workflow job for this annotation

GitHub Actions / tests (ubuntu-20.04, dataframe)

use of unstable library feature 'is_terminal'

Check failure on line 89 in crates/nu-system/src/foreground.rs

View workflow job for this annotation

GitHub Actions / tests (ubuntu-20.04, extra)

use of unstable library feature 'is_terminal'
use std::os::unix::prelude::{CommandExt, RawFd};

// TODO: when raising MSRV past 1.63.0, switch to OwnedFd
Expand Down
2 changes: 1 addition & 1 deletion src/terminal.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(unix)]
pub(crate) fn acquire_terminal(interactive: bool) {
use is_terminal::IsTerminal;
use nix::sys::signal::{signal, SigHandler, Signal};
use std::io::IsTerminal;

if !std::io::stdin().is_terminal() {
return;
Expand Down

0 comments on commit 55dc194

Please sign in to comment.