forked from extern/nushell
Use built-in is_terminal instead of is_terminal::is_terminal (#9550)
# Description This PR tries to remove ~atty~ is-terminal from the entire code base, since ~[atty is unmaintained](https://rustsec.org/advisories/RUSTSEC-2021-0145) and~ [`is_terminal` has been stabilized](https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html#isterminal) in rust 1.70.0. cc @fdncred # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect -A clippy::result_large_err` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass - `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. -->
This commit is contained in:
parent
27dcc3ecc3
commit
ad12018199
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -2564,7 +2564,6 @@ dependencies = [
|
||||
"criterion",
|
||||
"crossterm",
|
||||
"ctrlc",
|
||||
"is-terminal",
|
||||
"log",
|
||||
"miette",
|
||||
"mimalloc",
|
||||
@ -2621,7 +2620,6 @@ dependencies = [
|
||||
"crossterm",
|
||||
"fancy-regex",
|
||||
"fuzzy-matcher",
|
||||
"is-terminal",
|
||||
"is_executable",
|
||||
"log",
|
||||
"miette",
|
||||
@ -2753,7 +2751,6 @@ dependencies = [
|
||||
"htmlescape",
|
||||
"indexmap 2.0.0",
|
||||
"indicatif",
|
||||
"is-terminal",
|
||||
"itertools",
|
||||
"libc",
|
||||
"log",
|
||||
@ -2956,7 +2953,6 @@ name = "nu-system"
|
||||
version = "0.84.1"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"is-terminal",
|
||||
"libc",
|
||||
"libproc",
|
||||
"log",
|
||||
|
@ -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" }
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
@ -26,7 +25,7 @@ use reedline::{
|
||||
SqliteBackedHistory, Vi,
|
||||
};
|
||||
use std::{
|
||||
io::{self, Write},
|
||||
io::{self, IsTerminal, Write},
|
||||
path::Path,
|
||||
sync::atomic::Ordering,
|
||||
time::Instant,
|
||||
|
@ -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"] }
|
||||
|
@ -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};
|
||||
@ -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};
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user