fix: ensure execution task result is shown (#3629)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use tokio_util::sync::CancellationToken;
|
||||
|
||||
/// Safely truncate a string at character boundaries, not byte boundaries
|
||||
///
|
||||
/// This function ensures that multi-byte UTF-8 characters (like Japanese, emoji, etc.)
|
||||
@@ -18,6 +20,12 @@ pub fn safe_truncate(s: &str, max_chars: usize) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_token_cancelled(cancellation_token: &Option<CancellationToken>) -> bool {
|
||||
cancellation_token
|
||||
.as_ref()
|
||||
.is_some_and(|t| t.is_cancelled())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user