From ada1b39c628ffe4d7d31d899bb502e04bbe4ba95 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 16 Oct 2026 22:58:26 +0000 Subject: [PATCH] LinuxSystemTest: a failing distribution's shell closed too Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs --- .../neodesktop/dmodem/local/LinuxSystemTest.kt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/test/java/com/neodesktop/dmodem/local/LinuxSystemTest.kt b/app/src/test/java/com/neodesktop/dmodem/local/LinuxSystemTest.kt index a86b656..ed4fec2 100644 --- a/app/src/test/java/com/neodesktop/dmodem/local/LinuxSystemTest.kt +++ b/app/src/test/java/com/neodesktop/dmodem/local/LinuxSystemTest.kt @@ -181,12 +181,16 @@ class LinuxSystemTest { /** a package added with the system's own package manager, and run */ private fun packageManager(sys: LinuxSystem, id: String) { val (l, s) = shell(sys) - // (root's prompt, as the distribution's own start-up files may have it: openSUSE's "host:~ #") - waitFor("the prompt", s, 60) { it.trimEnd().endsWith("#") } - val cmd = INSTALL_LUA[id] ?: throw AssertionError("no command for $id") - l.write("$cmd && \$LUA -e 'print(\"lua says \" .. 6*7)'\r".toByteArray()) - waitFor("Lua from $id's package manager", s, secs = 900) { it.contains("lua says 42") } - l.close() + try { + // (root's prompt, as the distribution's own start-up files may have it: openSUSE's "host:~ #") + waitFor("the prompt", s, 60) { it.trimEnd().endsWith("#") } + val cmd = INSTALL_LUA[id] ?: throw AssertionError("no command for $id") + l.write("$cmd && \$LUA -e 'print(\"lua says \" .. 6*7)'\r".toByteArray()) + waitFor("Lua from $id's package manager", s, secs = 900) { it.contains("lua says 42") } + } finally { + // (a failure's shell closed too, not left in a removed system) + l.close() + } } /** a custom URL's: the Linux Containers' Alpine (an .xz), with its checksum */