Skip to content

Commit 763ced2

Browse files
committed
Flicker: Fix shell output handling to work cross-platform
Previously, shell output buffering caused rich console rendering errors on Linux while working fine on Windows. This update: - Fixed indentation of non-console chunk handling to ensure proper yielding - Simplified buffering logic to be more platform-agnostic - Ensured all chunk types are properly processed regardless of platform The changes maintain the benefits of reduced screen flicker for large outputs (like 'type' or 'cat' commands) while now working correctly on both Windows and Linux systems. Note: Shell commands still won't show progress until completion, but output is now properly rendered on all platforms.
1 parent edd225a commit 763ced2

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

interpreter/core/computer/terminal/terminal.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -190,17 +190,20 @@ def _streaming_run(self, language, code, display=False):
190190
shell_output += chunk["content"]
191191
continue
192192

193-
# For non-shell output or non-output chunks, yield normally
194-
yield chunk
195-
196-
# Print if display=True (but not for shell output which is handled separately)
197-
if (
198-
display
199-
and chunk.get("format") != "active_line"
200-
and chunk.get("content")
201-
and language != "shell"
202-
):
203-
print(chunk["content"], end="")
193+
# For non-shell output or non-output chunks, yield normally
194+
yield chunk
195+
196+
# Print if display=True (but not for shell output which is handled separately)
197+
if (
198+
display
199+
and chunk.get("format") != "active_line"
200+
and chunk.get("content")
201+
and language != "shell"
202+
):
203+
print(chunk["content"], end="")
204+
205+
else:
206+
yield chunk
204207

205208
# After collecting all shell output, yield it as one chunk for truncation
206209
if language == "shell" and shell_output:

0 commit comments

Comments
 (0)