From 6e109aec3668cf418664c546585c0b47f0565035 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Thu, 8 Oct 2026 00:36:50 -0400 Subject: [PATCH] test: keep script's stdin open in the linger test (CI has no stdin) Co-Authored-By: Claude Opus 5.5 --- tests/attach.bats | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/attach.bats b/tests/attach.bats index 4159487..6eaea3a 100644 --- a/tests/attach.bats +++ b/tests/attach.bats @@ -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"* ]] }