Separate input from enter submission in Slack bridge

This commit is contained in:
2026-02-17 05:55:49 +09:00
parent 51e63a0f85
commit 271376a7da
5 changed files with 88 additions and 14 deletions

View File

@@ -47,13 +47,20 @@ class PtyManager:
timeout=None,
)
def send(self, text: str) -> None:
def send(self, text: str, submit: bool = False) -> None:
"""프로세스에 텍스트 입력을 전달한다."""
if not self.is_alive:
raise RuntimeError("프로세스가 실행 중이 아닙니다.")
assert self._process is not None
logger.debug("입력 전송: %s", text)
self._process.sendline(text)
if submit:
self._process.sendline(text)
return
self._process.send(text)
def send_enter(self) -> None:
"""엔터 키 입력만 전송한다."""
self.send("", submit=True)
def read_output(self, timeout: float = 5) -> str:
"""프로세스의 출력을 읽는다."""