Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a03397-4d51-7fd1-8ff2-946eb22ea2bc
This commit is contained in:
parent
397a2b4d58
commit
68475922bb
15 changed files with 437 additions and 50 deletions
|
|
@ -16,16 +16,29 @@ class ControlModeClient:
|
|||
tmux_command: Sequence[str] | None = None
|
||||
process: subprocess.Popen[str] | None = None
|
||||
|
||||
def start(self) -> None:
|
||||
if self.process is not None:
|
||||
return
|
||||
def _command(self) -> tuple[str, ...]:
|
||||
socket_name = os.environ.get("TAMQ_TMUX_SOCKET")
|
||||
command = tuple(
|
||||
return tuple(
|
||||
self.tmux_command
|
||||
or (["tmux", "-L", socket_name] if socket_name else ["tmux"])
|
||||
)
|
||||
|
||||
def session_exists(self, expected_pid: int | None = None) -> bool:
|
||||
result = subprocess.run(
|
||||
[*self._command(), "display-message", "-p", "-t", self.session, "#{pid}"],
|
||||
text=True,
|
||||
capture_output=True,
|
||||
check=False,
|
||||
)
|
||||
if result.returncode != 0:
|
||||
return False
|
||||
return expected_pid is None or result.stdout.strip() == str(expected_pid)
|
||||
|
||||
def start(self) -> None:
|
||||
if self.process is not None:
|
||||
return
|
||||
self.process = subprocess.Popen(
|
||||
[*command, "-C", "attach-session", "-t", self.session],
|
||||
[*self._command(), "-C", "attach-session", "-t", self.session],
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue