Skip to content

Commit 53bf604

Browse files
committedNov 4, 2024·
Replace atty with std is terminal
1 parent d720c90 commit 53bf604

File tree

3 files changed

+4
-25
lines changed

3 files changed

+4
-25
lines changed
 

‎Cargo.lock

-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ gitql-cli = "0.28.0"
1919
gitql-ast = "0.25.0"
2020
gitql-parser = "0.27.0"
2121
gitql-engine = "0.28.0"
22-
atty = "0.2.14"
2322
clang-sys = "1.8.1"

‎src/main.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
use std::io::IsTerminal;
12
use std::path::Path;
23

34
use crate::engine::EvaluationResult::SelectedGroups;
45
use arguments::Arguments;
56
use arguments::Command;
6-
use atty::Stream;
77
use data_provider::ClangAstDataProvider;
88
use gitql_cli::arguments::OutputFormat;
99
use gitql_cli::diagnostic_reporter;
@@ -101,13 +101,14 @@ fn launch_clangql_repl(arguments: Arguments) {
101101
let mut input = String::new();
102102

103103
loop {
104+
let stdio = std::io::stdin();
104105
// Render Prompt only if input is received from terminal
105-
if atty::is(Stream::Stdin) {
106+
if stdio.is_terminal() {
106107
print!("clangql > ");
107108
}
108109

109110
std::io::Write::flush(&mut std::io::stdout()).expect("flush failed!");
110-
match std::io::stdin().read_line(&mut input) {
111+
match stdio.read_line(&mut input) {
111112
Ok(buffer_length) => {
112113
if buffer_length == 0 {
113114
break;

0 commit comments

Comments
 (0)
Please sign in to comment.