Skip to content

Commit 15b70fb

Browse files
committed
Flicker: print message about not showing output until completion
Improve shell command output handling - Buffer shell command output to prevent terminal unresponsiveness - Update display periodically (every second) for large outputs - Add user notification about output buffering behavior - Maintain truncation through terminal interface This significantly improves the user experience when viewing large outputs by preventing excessive screen updates. Note that due to OS-level output buffering, shell commands won't show progress until completion. Revert "try to fix buffering" This reverts commit 9ccee4d26bab9267007760947f3c95bbb93a1fa2. try to fix buffering not sure Try to best of both worlds
1 parent 763ced2 commit 15b70fb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

interpreter/core/computer/terminal/terminal.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,9 @@ def _streaming_run(self, language, code, display=False):
163163
else:
164164
self._active_languages[language] = lang_class()
165165
try:
166-
# Buffer for shell output - collect all output before displaying to prevent screen flicker
167-
# Note: This means shell commands won't show progress until completion
166+
# Buffer for shell output - collect output and update periodically to prevent terminal
167+
# unresponsiveness with large outputs. Note: This means shell commands won't show
168+
# progress until completion due to OS-level output buffering.
168169
shell_output = ""
169170

170171
for chunk in self._active_languages[language].run(code):
@@ -187,6 +188,13 @@ def _streaming_run(self, language, code, display=False):
187188
# For shell commands, buffer the output instead of streaming
188189
# This prevents screen flicker with large outputs like 'type' or 'cat'
189190
if language == "shell":
191+
# First shell command output - inform user about buffering
192+
if not shell_output:
193+
yield {
194+
"type": "console",
195+
"format": "output",
196+
"content": "Note: Shell command output will be shown after completion.\n\n"
197+
}
190198
shell_output += chunk["content"]
191199
continue
192200

0 commit comments

Comments
 (0)