pexpects/fg: Don't use sleep on NetBSD

NetBSD's sleep quits when foregrounded sometimes. I'm not entirely
sure *why*, but this is reproducible with the default /bin/sh, so it's
not our fault.

Because this fails our tests, go back to using cat *there*, because we
can't use it on macOS - 4c9d01cab0.
This commit is contained in:
Fabian Homborg 2021-02-24 19:52:51 +01:00
parent bb0d4ed878
commit b154ad6a5c

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python3
from pexpect_helper import SpawnedProc
import platform
import subprocess
import sys
import time
@ -15,7 +16,10 @@ send, sendline, sleep, expect_prompt, expect_re, expect_str = (
)
expect_prompt()
sendline("sleep 500")
# Hack: NetBSD's sleep likes quitting when waking up
# (but also does so under /bin/sh)
testproc="sleep 500" if platform.system() != "NetBSD" else "cat"
sendline(testproc)
sendline("set -l foo bar; echo $foo")
expect_str("")
sleep(0.2)
@ -29,7 +33,7 @@ expect_str("bar")
expect_prompt()
sendline("fg")
expect_str("Send job 1, 'sleep 500' to foreground")
expect_str("Send job 1, '" + testproc + "' to foreground")
sleep(0.2)
sendline("set -l foo bar; echo $foo")
expect_str("")