test(desktop): make the hung-command test fork whichever shell /bin/sh is

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vitor Pamplona
2026-10-01 14:42:48 -04:00
co-authored by Claude Opus 5.5
parent 391e371259
commit 33aa0ba90b
@@ -234,7 +234,10 @@ class OsNowPlayingReaderTest {
runTest { runTest {
if (!hasShell) return@runTest if (!hasShell) return@runTest
val started = System.currentTimeMillis() val started = System.currentTimeMillis()
assertNull(runCommand(listOf("/bin/sh", "-c", "sleep 30"), timeoutSeconds = 1)) // `; true` makes every shell fork `sleep` rather than exec it, as dash always does, so the
// child that outlives a killed shell is exercised whichever shell /bin/sh is. Only Linux
// JDKs then block on the pipe (macOS closes it on destroy): the check bites on Linux CI.
assertNull(runCommand(listOf("/bin/sh", "-c", "sleep 30; true"), timeoutSeconds = 1))
assertTrue(System.currentTimeMillis() - started < 10_000, "the timeout must end the call") assertTrue(System.currentTimeMillis() - started < 10_000, "the timeout must end the call")
} }
} }