Skip to content

Commit a36349a

Browse files
Crivellasmoors
andauthored
Update easybuild/tools/build_log.py
Co-authored-by: Sam Moors <smoors@users.noreply.github.com>
1 parent 6c2d950 commit a36349a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

easybuild/tools/build_log.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,14 +336,14 @@ def print_msg(msg, *args, **kwargs):
336336
msg += '\n'
337337

338338
if use_rich():
339-
from io import StringIO
340339
from rich.markup import escape
341340
from rich.console import Console
342341

343-
buff = StringIO()
344-
console = Console(file=buff, force_terminal=sys.stdout.isatty())
345-
console.print(escape(msg), end='')
346-
msg = buff.getvalue()
342+
console = Console(force_terminal=sys.stdout.isatty())
343+
with console.capture() as capture:
344+
console.print(escape(msg), end="")
345+
346+
msg = capture.get()
347347

348348
if stderr:
349349
sys.stderr.write(msg)

0 commit comments

Comments
 (0)