File tree Expand file tree Collapse file tree 2 files changed +29
-7
lines changed
openhands-tools/openhands/tools/terminal/terminal Expand file tree Collapse file tree 2 files changed +29
-7
lines changed Original file line number Diff line number Diff line change 1+ import platform
2+ from typing import TYPE_CHECKING
3+
14from openhands .tools .terminal .terminal .factory import create_terminal_session
25from openhands .tools .terminal .terminal .interface import (
36 TerminalInterface ,
47 TerminalSessionBase ,
58)
6- from openhands .tools .terminal .terminal .subprocess_terminal import (
7- SubprocessTerminal ,
8- )
99from openhands .tools .terminal .terminal .terminal_session import (
1010 TerminalCommandStatus ,
1111 TerminalSession ,
1212)
13- from openhands .tools .terminal .terminal .tmux_terminal import TmuxTerminal
13+
14+
15+ # These backends depend on Unix-only modules (fcntl, pty, libtmux)
16+ if platform .system () != "Windows" :
17+ from openhands .tools .terminal .terminal .subprocess_terminal import (
18+ SubprocessTerminal ,
19+ )
20+ from openhands .tools .terminal .terminal .tmux_terminal import TmuxTerminal
21+
22+ if TYPE_CHECKING :
23+ from openhands .tools .terminal .terminal .subprocess_terminal import (
24+ SubprocessTerminal ,
25+ )
26+ from openhands .tools .terminal .terminal .tmux_terminal import TmuxTerminal
1427
1528
1629__all__ = [
Original file line number Diff line number Diff line change 11"""PTY-based terminal backend implementation (replaces pipe-based subprocess)."""
22
3- import fcntl
43import os
5- import pty
4+ import platform
65import re
7- import select
86import shutil
97import signal
108import subprocess
119import threading
1210import time
1311from collections import deque
1412
13+
14+ if platform .system () == "Windows" :
15+ raise ImportError (
16+ "SubprocessTerminal is not supported on Windows "
17+ "(requires Unix-only modules: fcntl, pty, select)"
18+ )
19+
20+ import fcntl
21+ import pty
22+ import select
23+
1524from openhands .sdk .logger import get_logger
1625from openhands .sdk .utils import sanitized_env
1726from openhands .tools .terminal .constants import (
You can’t perform that action at this time.
0 commit comments