mirror of
https://github.com/instructkr/claw-code.git
synced 2026-10-17 00:00:05 +08:00
fix: restore is_terminal() check for spinner in run_turn
The terminal check was removed during merge conflict resolution, causing the spinner animation to be output to non-TTY streams (like pipes used in tests), which corrupted the output format and broke the text_prompt_mode_keeps_streamed_text_when_the_turn_fails test. Restore the is_terminal() check to only animate when stdout is a real terminal while keeping the interrupt feature.
This commit is contained in:
1 parent
d4578586eb
commit
ab839bcfda
1 file changed
+17
-9
@@ -7895,15 +7895,23 @@ impl LiveCli {
|
||||
}
|
||||
let mut spinner = Spinner::new();
|
||||
let mut stdout = io::stdout();
|
||||
spinner.tick(
|
||||
if escape_monitor.is_some() {
|
||||
"🦀 Thinking... (esc to interrupt)"
|
||||
} else {
|
||||
"🦀 Thinking..."
|
||||
},
|
||||
TerminalRenderer::new().color_theme(),
|
||||
&mut stdout,
|
||||
)?;
|
||||
// The animated frame is cursor control: it saves the cursor, rewrites the
|
||||
// current line, and restores the cursor. None of that describes anything
|
||||
// when stdout is a pipe — the escapes survive as literal bytes and the
|
||||
// banner ends up glued to whatever the emitter writes next. Only animate
|
||||
// on a terminal; the one-shot completion line below is plain text and is
|
||||
// emitted either way.
|
||||
if io::stdout().is_terminal() {
|
||||
spinner.tick(
|
||||
if escape_monitor.is_some() {
|
||||
"🦀 Thinking... (esc to interrupt)"
|
||||
} else {
|
||||
"🦀 Thinking..."
|
||||
},
|
||||
TerminalRenderer::new().color_theme(),
|
||||
&mut stdout,
|
||||
)?
|
||||
}
|
||||
let result = runtime.run_turn(input, Some(&mut permission_prompter));
|
||||
if let Some(monitor) = escape_monitor {
|
||||
monitor.stop();
|
||||
|
||||
Reference in new issue
Block a user