Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions openhands-tools/openhands/tools/terminal/terminal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
import platform
from typing import TYPE_CHECKING

from openhands.tools.terminal.terminal.factory import create_terminal_session
from openhands.tools.terminal.terminal.interface import (
TerminalInterface,
TerminalSessionBase,
)
from openhands.tools.terminal.terminal.subprocess_terminal import (
SubprocessTerminal,
)
from openhands.tools.terminal.terminal.terminal_session import (
TerminalCommandStatus,
TerminalSession,
)
from openhands.tools.terminal.terminal.tmux_terminal import TmuxTerminal


# These backends depend on Unix-only modules (fcntl, pty, libtmux)
if platform.system() != "Windows":
from openhands.tools.terminal.terminal.subprocess_terminal import (
SubprocessTerminal,
)
from openhands.tools.terminal.terminal.tmux_terminal import TmuxTerminal

if TYPE_CHECKING:
from openhands.tools.terminal.terminal.subprocess_terminal import (
SubprocessTerminal,
)
from openhands.tools.terminal.terminal.tmux_terminal import TmuxTerminal


__all__ = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
"""PTY-based terminal backend implementation (replaces pipe-based subprocess)."""

import fcntl
import os
import pty
import platform
import re
import select
import shutil
import signal
import subprocess
import threading
import time
from collections import deque


if platform.system() == "Windows":
raise ImportError(
"SubprocessTerminal is not supported on Windows "
"(requires Unix-only modules: fcntl, pty, select)"
)

import fcntl
import pty
import select

from openhands.sdk.logger import get_logger
from openhands.sdk.utils import sanitized_env
from openhands.tools.terminal.constants import (
Expand Down
Loading