Skip to content

feat: add Windows terminal support#15

Open
ping1979ping wants to merge 1 commit intoConstantineB6:mainfrom
ping1979ping:feat/windows-terminal-support
Open

feat: add Windows terminal support#15
ping1979ping wants to merge 1 commit intoConstantineB6:mainfrom
ping1979ping:feat/windows-terminal-support

Conversation

@ping1979ping
Copy link
Copy Markdown

Summary

  • Adds WindowsTerminal class using subprocess.Popen with pipes (stdin/stdout/stderr) as a Windows alternative to the Unix PTY-based WebSocketTerminal
  • Updates websocket_handler to use WindowsTerminal on Windows instead of rejecting the connection
  • Enables MCP auto-config (setup_mcp_config) on Windows — previously skipped entirely

Details

The embedded xterm.js terminal was completely disabled on Windows because it relied on Unix-only modules (pty, fcntl, termios, select). Windows users saw "Terminal disconnected" immediately.

This PR adds a WindowsTerminal class that:

  • Spawns the Claude CLI via subprocess.Popen with piped I/O
  • Reads stdout/stderr in daemon threads, forwarding output to the WebSocket
  • Handles .CMD files (like claude.CMD) correctly via cmd /c
  • Uses CREATE_NEW_PROCESS_GROUP for clean process termination

No new dependencies. No changes to the Unix code path. The existing WebSocketTerminal class remains untouched.

Test plan

  • Verify ComfyUI starts on Windows with log: Windows terminal support enabled (subprocess mode)
  • Verify terminal connects in browser (no "Terminal disconnected" error)
  • Verify Claude Code starts and accepts input in the embedded terminal
  • Verify MCP tools (edit_graph, get_workflow, etc.) work from Claude Code
  • Verify Unix/macOS behavior is unchanged (no regressions)

🤖 Generated with Claude Code

Previously the embedded xterm.js terminal was completely disabled on
Windows due to missing Unix PTY modules (pty, fcntl, termios). This
adds a WindowsTerminal class that uses subprocess.Popen with pipes
to provide terminal functionality on Windows.

Changes:
- Add WindowsTerminal class using subprocess.Popen with stdin/stdout/stderr pipes
- Update websocket_handler to use WindowsTerminal on Windows instead of rejecting
- Enable MCP auto-config (setup_mcp_config) on Windows
- Update platform/status endpoints to report terminal_supported=True

No new dependencies required. Unix implementation remains unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@erratos
Copy link
Copy Markdown

erratos commented Mar 29, 2026

Windows Terminal: → (ConPTY)

Tested on Windows 11, ComfyUI via StabilityMatrix. Fixed with the help of Claude Code.

The class in this PR uses with pipes, which does not create a real TTY. Claude Code detects it is not in an interactive terminal and falls back to mode:


The fix is to use pywinpty (Windows ConPTY API) instead — Claude Code then sees a real TTY and starts interactively.

➡️ A working implementation has been submitted as PR #18: #18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants