From 9922d942497ba16d2577ed01f36aa31afaa1df0e Mon Sep 17 00:00:00 2001 From: tison Date: Tue, 4 Aug 2026 05:45:16 +0800 Subject: [PATCH 1/2] fix: try resolve repl io Signed-off-by: tison --- Cargo.lock | 10 ---------- scopeql/Cargo.toml | 1 - scopeql/src/repl/entrypoint.rs | 23 ++++++----------------- 3 files changed, 6 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b8b5692..12d1955 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2332,15 +2332,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" -[[package]] -name = "mea" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31fc7d159de0085ab6dd7ff145a9819442cfd3d098f783263120503c3f3e58b0" -dependencies = [ - "slab", -] - [[package]] name = "memchr" version = "2.8.3" @@ -2901,7 +2892,6 @@ dependencies = [ "jiff", "log", "logforth", - "mea", "memchr", "nu-ansi-term", "reedline", diff --git a/scopeql/Cargo.toml b/scopeql/Cargo.toml index e20d2df..e4db6c1 100644 --- a/scopeql/Cargo.toml +++ b/scopeql/Cargo.toml @@ -46,7 +46,6 @@ indicatif = { version = "0.18.6" } jiff = { version = "0.2.35", features = ["serde"] } log = { version = "0.4.33" } logforth = { version = "0.30.1", features = ["starter-log"] } -mea = { version = "0.6.5" } memchr = { version = "2.8.3" } nu-ansi-term = { version = "0.50.3" } reedline = { version = "0.49.0" } diff --git a/scopeql/src/repl/entrypoint.rs b/scopeql/src/repl/entrypoint.rs index 27edc77..b104e7c 100644 --- a/scopeql/src/repl/entrypoint.rs +++ b/scopeql/src/repl/entrypoint.rs @@ -20,7 +20,6 @@ use clap::Parser; use exn::Result; use indicatif::ProgressBar; use indicatif::ProgressStyle; -use mea::latch::Latch; use nu_ansi_term::Color; use nu_ansi_term::Style; use reedline::DefaultHinter; @@ -249,9 +248,10 @@ pub fn entrypoint(config: &Config) { } loop { - let input = line_editor - .read_line(&repl.prompt) - .expect("failed to read next line"); + let Ok(input) = line_editor.read_line(&repl.prompt) else { + continue; + }; + let input = match input { Signal::Success(input) if input == CTRL_C_PROMPT_COMMAND || input == CTRL_D_PROMPT_COMMAND => @@ -388,18 +388,7 @@ pub fn entrypoint(config: &Config) { let pb_style = "{spinner:.green} [{elapsed_precise}] {msg:.green.bold.bright} [{wide_bar:.cyan/blue}] {bytes}/{total_bytes} ({bytes_per_sec})"; let pb = ProgressBar::no_length() .with_style(ProgressStyle::with_template(pb_style).unwrap()); - let stop_pb = Arc::new(Latch::new(1)); - - global::rt().spawn({ - let pb = pb.clone(); - let stop_pb = stop_pb.clone(); - async move { - while stop_pb.try_wait().is_err() { - tokio::time::sleep(Duration::from_millis(42)).await; - pb.tick(); - } - } - }); + pb.enable_steady_tick(Duration::from_millis(42)); let client = &repl.client; let output_format = repl.output_format; @@ -432,7 +421,7 @@ pub fn entrypoint(config: &Config) { } }); - stop_pb.count_down(); + pb.disable_steady_tick(); pb.finish_and_clear(); match output { From 910faeb99975c16157727a63a982eed47ba150fa Mon Sep 17 00:00:00 2001 From: tison Date: Tue, 4 Aug 2026 05:58:39 +0800 Subject: [PATCH 2/2] dirty hack Signed-off-by: tison --- scopeql/src/repl/entrypoint.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scopeql/src/repl/entrypoint.rs b/scopeql/src/repl/entrypoint.rs index b104e7c..f6ec328 100644 --- a/scopeql/src/repl/entrypoint.rs +++ b/scopeql/src/repl/entrypoint.rs @@ -248,8 +248,18 @@ pub fn entrypoint(config: &Config) { } loop { - let Ok(input) = line_editor.read_line(&repl.prompt) else { - continue; + let input = match line_editor.read_line(&repl.prompt) { + Ok(input) => input, + Err(err) => { + if matches!(err.kind(), std::io::ErrorKind::Other) { + let err = err.to_string(); + if err.contains("cursor position could not be read within a normal duration") { + continue; + } + } + eprintln!("error: failed to read input: {err}"); + return; + } }; let input = match input {