Skip to content

Commit d0859b6

Browse files
committed
fix GitHub Actions run #5
1 parent c695572 commit d0859b6

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/xulbux/console.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from prompt_toolkit.styles import Style
1818
from prompt_toolkit.keys import Keys
1919
from contextlib import contextmanager
20+
from io import StringIO
2021
import prompt_toolkit as _pt
2122
import threading as _threading
2223
import keyboard as _keyboard
@@ -26,7 +27,6 @@
2627
import time as _time
2728
import sys as _sys
2829
import os as _os
29-
import io
3030

3131
try:
3232
from mypy_extensions import mypyc_attr # type: ignore[import]
@@ -1844,14 +1844,15 @@ def _redraw_display(self) -> None:
18441844

18451845

18461846
@mypyc_attr(native_class=False)
1847-
class _InterceptedOutput(io.StringIO):
1847+
class _InterceptedOutput:
18481848
"""Custom StringIO that captures output and stores it in the progress bar buffer."""
18491849

18501850
def __init__(self, progress_bar: ProgressBar | Spinner):
1851-
super().__init__()
1851+
self.string_io = StringIO()
18521852
self.progress_bar = progress_bar
18531853

18541854
def write(self, content: str) -> int:
1855+
self.string_io.write(content)
18551856
try:
18561857
if content and content != "\r":
18571858
self.progress_bar._buffer.append(content)
@@ -1861,10 +1862,14 @@ def write(self, content: str) -> int:
18611862
raise
18621863

18631864
def flush(self) -> None:
1865+
self.string_io.flush()
18641866
try:
18651867
if self.progress_bar.active and self.progress_bar._buffer:
18661868
self.progress_bar._flush_buffer()
18671869
self.progress_bar._redraw_display()
18681870
except Exception:
18691871
self.progress_bar._emergency_cleanup()
18701872
raise
1873+
1874+
def __getattr__(self, name: str) -> Any:
1875+
return getattr(self.string_io, name)

0 commit comments

Comments
 (0)