From 066dbc1d395097e66ff687fb4d63d18600be9455 Mon Sep 17 00:00:00 2001 From: Robert McMahon Date: Fri, 3 Apr 2026 13:09:01 -0700 Subject: [PATCH] SSH remote fiwi: run Python with -u for captured stdout over pipes. Without a TTY, libc/BrainStem output can stay block-buffered while the SSH client captures the remote stdout pipe, so discover could exit 0 with an empty transcript. Unbuffered mode fixes test_read_remote and invoke_capture. Made-with: Cursor --- fiwi/ssh.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fiwi/ssh.py b/fiwi/ssh.py index e5ef8d1..0f18414 100644 --- a/fiwi/ssh.py +++ b/fiwi/ssh.py @@ -550,13 +550,16 @@ class SshNode: @classmethod def _fiwi_remote_shell_command(cls, cfg: SshNodeConfig, remote_args: List[str]) -> str: """ - Single remote command string for ``bash -lc`` so ``~/`` in ``FIWI_REMOTE_*`` paths expands + Single remote command string for ``bash -lc`` so ``~/`` in ``FIWI_REMOTE_*`` paths expand on the *remote* host (quoted tilde literals would not). + + ``-u`` forces unbuffered stdout/stderr so SSH pipe capture (no TTY) still receives + BrainStem and libc output from ``discover`` and similar commands. """ py = cls.remote_path_bash_word(cfg.python) sc = cls.remote_path_bash_word(cfg.script) tail = " ".join(shlex.quote(p) for p in remote_args) - return f"{py} {sc}" + (f" {tail}" if tail else "") + return f"{py} -u {sc}" + (f" {tail}" if tail else "") def _fiwi_cmd_argv(self, cfg: SshNodeConfig, remote_args: List[str]) -> List[str]: inner = self._fiwi_remote_shell_command(cfg, remote_args)