mirror of
https://github.com/open-webui/computer.git
synced 2026-11-27 07:39:21 -05:00
refac
This commit is contained in:
1 parent
c487081e7c
commit
cfec1eb931
2 files changed
+17
-3
No files matched your search
+12
-1
@@ -18,6 +18,10 @@ SCROLLBACK_SIZE = 64 * 1024 # 64 KB
|
||||
IS_WINDOWS = platform.system() == "Windows"
|
||||
|
||||
|
||||
class TerminalUnavailable(RuntimeError):
|
||||
"""Raised when the platform terminal backend cannot be loaded."""
|
||||
|
||||
|
||||
@dataclass
|
||||
class TerminalSession:
|
||||
"""Platform-agnostic terminal session with scrollback buffer."""
|
||||
@@ -194,7 +198,14 @@ def _create_windows(
|
||||
session_id: str, shell: str, work_dir: str, env: dict, rows: int, cols: int
|
||||
) -> TerminalSession:
|
||||
"""Create a terminal session on Windows using pywinpty."""
|
||||
from winpty import PtyProcess # type: ignore
|
||||
try:
|
||||
from winpty import PtyProcess # type: ignore
|
||||
except (ImportError, OSError) as exc:
|
||||
raise TerminalUnavailable(
|
||||
"Windows terminal support requires pywinpty and the Microsoft Visual C++ "
|
||||
"Redistributable. Install the latest supported Visual C++ Redistributable "
|
||||
"from Microsoft, then restart cptr."
|
||||
) from exc
|
||||
|
||||
proc = PtyProcess.spawn(
|
||||
[shell],
|
||||
|
||||
Reference in new issue
Block a user