fix(macos-container): forward TERM env var in container exec --tty
Without TERM, Claude Code inside the container cannot determine which modifier-key protocol to enable (modifyOtherKeys / kitty). The inner PTY session has no terminal-type context, so Shift+Enter and Enter produce identical byte sequences (\r), making them indistinguishable. Pass the host TERM via --env TERM=<value> on every container exec --interactive --tty call, falling back to xterm-256color when TERM is not set on the host. Non-TTY exec paths are unaffected. Closes #245
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
from typing import Callable, cast
|
||||
|
||||
@@ -47,6 +48,11 @@ class MacosContainerBottle(Bottle):
|
||||
cmd = ["container", "exec"]
|
||||
if tty:
|
||||
cmd.extend(["--interactive", "--tty"])
|
||||
# Forward TERM so Claude Code can enable modifier-key protocols
|
||||
# (e.g. modifyOtherKeys). Without it the inner PTY session has no
|
||||
# TERM and Shift+Enter is indistinguishable from plain Enter.
|
||||
term = os.environ.get("TERM", "xterm-256color")
|
||||
cmd.extend(["--env", f"TERM={term}"])
|
||||
if self.agent_workdir and self.agent_workdir != "/home/node":
|
||||
cmd.extend(["--workdir", self.agent_workdir])
|
||||
cmd.extend([self.name, self.agent_command, *full_argv])
|
||||
|
||||
Reference in New Issue
Block a user