Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use built-in is_terminal instead of is_terminal::is_terminal #9550

Merged
merged 3 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -93,7 +93,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.84.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.10", 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 @@ -49,7 +49,6 @@ fs_extra = "1.3"
htmlescape = "0.3"
indexmap = "2.0"
indicatif = "0.17"
is-terminal = "0.4.8"
itertools = "0.10"
log = "0.4"
lscolors = { version = "0.15", 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 @@ -15,6 +14,7 @@ use nu_table::{
TableOutput,
};
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 @@ -83,11 +83,11 @@ impl Drop for ForegroundChild {
// It's a simpler version of fish shell's external process handling.
#[cfg(unix)]
mod fg_process_setup {
use is_terminal::IsTerminal;
use nix::{
sys::signal,
unistd::{self, Pid},
};
use std::io::IsTerminal;
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,11 +1,11 @@
#[cfg(unix)]
pub(crate) fn acquire_terminal(interactive: bool) {
use is_terminal::IsTerminal;
use nix::{
errno::Errno,
sys::signal::{signal, SigHandler, Signal},
unistd,
};
use std::io::IsTerminal;

if interactive && std::io::stdin().is_terminal() {
// see also: https://www.gnu.org/software/libc/manual/html_node/Initializing-the-Shell.html
Expand Down