test: keep script's stdin open in the linger test (CI has no stdin)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 00:36:50 -04:00
co-authored by Claude Opus 5.5
parent 05057f695d
commit a7838915fb
+5 -3
View File
@@ -333,14 +333,16 @@ posts() { [ -f "$TMP/posts" ] && wc -l <"$TMP/posts" || echo 0; }
start=$(date +%s%N)
DEVDESK_VIA_TTYD=1 DEVDESK_LINGER=2 devdesk attach --list >/dev/null
[ $(( ($(date +%s%N) - start) / 1000000 )) -lt 1500 ]
# On a tty, as under ttyd: the reply is printed, then it waits.
# On a tty, as under ttyd: the reply is printed, then it waits. script's
# stdin stays open (like a browser that hasn't hung up); a closed stdin
# would hand the command EOF at once.
start=$(date +%s%N)
run script -qec "DEVDESK_VIA_TTYD=1 DEVDESK_LINGER=0.6 '$REPO/bin/devdesk' attach --list" /dev/null
run bash -c "sleep 2 | script -qec \"DEVDESK_VIA_TTYD=1 DEVDESK_LINGER=0.6 '$REPO/bin/devdesk' attach --list\" /dev/null"
elapsed=$(( ($(date +%s%N) - start) / 1000000 ))
[[ $output == *'"sessions"'* ]]
[ "$elapsed" -ge 500 ]
# Errors are printed before the wait, too.
run script -qec "DEVDESK_VIA_TTYD=1 DEVDESK_LINGER=0.3 '$REPO/bin/devdesk' attach --rename nosuch x" /dev/null
run bash -c "sleep 1 | script -qec \"DEVDESK_VIA_TTYD=1 DEVDESK_LINGER=0.3 '$REPO/bin/devdesk' attach --rename nosuch x\" /dev/null"
[[ $output == *"no session named"* ]]
}