diff --git a/packages/copper/Cargo.toml b/packages/copper/Cargo.toml index 84fe269..b7843f1 100644 --- a/packages/copper/Cargo.toml +++ b/packages/copper/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pistonite-cu" -version = "0.8.3" +version = "0.8.4" edition = "2024" description = "Battery-included common utils to speed up development of rust tools" repository = "https://github.com/Pistonite/cu" diff --git a/packages/copper/src/co/handle.rs b/packages/copper/src/co/handle.rs index ae473f5..3944ee2 100644 --- a/packages/copper/src/co/handle.rs +++ b/packages/copper/src/co/handle.rs @@ -232,11 +232,11 @@ impl RobustHandle { /// use std::time::Duration; /// /// let handle = cu::co::spawn(async move { - /// tokio::time::sleep(Duration::from_millis(10)).await; + /// tokio::time::sleep(Duration::from_millis(100)).await; /// 42 /// }).into_robust(); /// - /// std::thread::sleep(Duration::from_millis(20)); + /// std::thread::sleep(Duration::from_millis(200)); /// assert!(handle.abort(), "task is not joined yet, so abort is possible"); /// match handle.join_maybe_aborted_robust() { /// Err(e) => panic!("join failed: {e}"), diff --git a/packages/copper/src/process/pio/cargo_preset.rs b/packages/copper/src/process/pio/cargo_preset.rs index 229e119..36343c8 100644 --- a/packages/copper/src/process/pio/cargo_preset.rs +++ b/packages/copper/src/process/pio/cargo_preset.rs @@ -369,11 +369,19 @@ impl PrintState { static STATUS_REGEX: LazyLock = LazyLock::new(|| { Regex::new("^((\x1b[^m]*m)|\\s)*(Compiling|Checking)((\x1b[^m]*m)|\\s)*").unwrap() }); + static OTHER_STATUS_REGEX: LazyLock = LazyLock::new(|| { + Regex::new("^((\x1b[^m]*m)|\\s)*(Downloading|Downloaded)((\x1b[^m]*m)|\\s)*").unwrap() + }); static ERROR_REGEX: LazyLock = LazyLock::new(|| Regex::new("^((\x1b[^m]*m)|\\s)*error").unwrap()); static WARNING_REGEX: LazyLock = LazyLock::new(|| Regex::new("^((\x1b[^m]*m)|\\s)*warning").unwrap()); let Some(m) = STATUS_REGEX.find(line) else { + if OTHER_STATUS_REGEX.is_match(line) { + crate::cli::__print_with_level(self.other_lv, format_args!("{line}")); + self.stderr_printing_message_lv = None; + return; + } // some error/warning messages aren't emited to stdout, // so we use a regex to match and print them if let Some(lv) = self.stderr_printing_message_lv {