Commit 85f3d5f8 authored by Perceval Guillou's avatar Perceval Guillou
Browse files

patch StdoutProxy

parent 175aca9f
Pipeline #75583 passed with stages
in 100 minutes and 44 seconds
...@@ -28,7 +28,11 @@ from collections import deque ...@@ -28,7 +28,11 @@ from collections import deque
from datetime import datetime from datetime import datetime
import ptpython.layout import ptpython.layout
from prompt_toolkit.patch_stdout import patch_stdout as patch_stdout_context from prompt_toolkit.patch_stdout import (
patch_stdout as patch_stdout_context,
StdoutProxy,
)
from prompt_toolkit import patch_stdout as patch_stdout_module
from prompt_toolkit.output import DummyOutput from prompt_toolkit.output import DummyOutput
# imports needed to have control over _execute of ptpython # imports needed to have control over _execute of ptpython
...@@ -61,6 +65,17 @@ from bliss.common.protocols import ErrorReportInterface ...@@ -61,6 +65,17 @@ from bliss.common.protocols import ErrorReportInterface
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class BlissStdoutProxy(StdoutProxy):
def _write(self, data: str):
res = super()._write(data)
if "\r" in data:
self.flush()
return res
patch_stdout_module.StdoutProxy = BlissStdoutProxy
if is_windows(): if is_windows():
class Terminal: class Terminal:
...@@ -69,6 +84,7 @@ if is_windows(): ...@@ -69,6 +84,7 @@ if is_windows():
raise AttributeError(prop) raise AttributeError(prop)
return "" return ""
else: else:
from blessings import Terminal from blessings import Terminal
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment