fix(@scripts/session-tools): 🐛 handle pipe stdin in remote triage command

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-05-17 22:30:01 -07:00
parent 0f823b4ecd
commit 34daed5aca

View file

@ -553,7 +553,11 @@ list_triage_on() {
echo "rclaude: no python with claude_code_batch_sdk found locally" >&2 echo "rclaude: no python with claude_code_batch_sdk found locally" >&2
return 1 return 1
fi fi
"$PY" "$_helper" "$@" 2>/dev/null || true # Detach stdin: the SDK spawns claude CLI subprocesses that inherit
# stdin from our caller. If we're invoked inside `scan_hosts | while
# read`, those subprocesses eat the pipe and the loop dies after the
# first host. </dev/null isolates us.
"$PY" "$_helper" "$@" </dev/null 2>/dev/null || true
else else
_args="" _args=""
for a in "$@"; do for a in "$@"; do
@ -563,8 +567,7 @@ list_triage_on() {
# pre-installed on the remote. # pre-installed on the remote.
ssh -o BatchMode=yes -o ConnectTimeout=5 "$_host" \ ssh -o BatchMode=yes -o ConnectTimeout=5 "$_host" \
"${_REMOTE_TRIAGE_BOOT} \$PY -${_args}" \ "${_REMOTE_TRIAGE_BOOT} \$PY -${_args}" \
< "$_helper" 2>>/tmp/rclaude-debug.log \ < "$_helper" 2>/dev/null || true
| tee -a "/tmp/rclaude-debug-stdout-${_host}.log" || true
fi | awk -F'\t' -v host="$_host" ' fi | awk -F'\t' -v host="$_host" '
# _claude-triage writes informational lines starting with "# " to # _claude-triage writes informational lines starting with "# " to
# stderr; the stdout we capture is pure TSV. Each row: # stderr; the stdout we capture is pure TSV. Each row: