From 06d728b218680ff05d0697fac686c58669ff9cd9 Mon Sep 17 00:00:00 2001 From: wallentx Date: Sun, 11 Oct 2026 20:45:42 -0500 Subject: [PATCH] Capture raw stderr before test worker termination --- .../droiddeck/launcher/session/CrashHandler.kt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/droiddeck/launcher/session/CrashHandler.kt b/app/src/main/java/com/droiddeck/launcher/session/CrashHandler.kt index 1a0a66933..f079243e6 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/CrashHandler.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/CrashHandler.kt @@ -39,7 +39,20 @@ object CrashHandler { } catch (e: Throwable) { // Nothing more to do for a crash inside the crash handler. } finally { - previous?.uncaughtException(thread, error) ?: Runtime.getRuntime().halt(2) + if (previous != null) { + previous.uncaughtException(thread, error) + } else { + // Temporary: bypass captured System.err when diagnosing the test worker's exit 2. + try { + val raw = java.io.PrintStream(java.io.FileOutputStream(java.io.FileDescriptor.err), true) + raw.println("DroidDeck CrashHandler: uncaught on ${thread.name}") + error.printStackTrace(raw) + raw.flush() + } catch (_: Throwable) { + } finally { + Runtime.getRuntime().halt(2) + } + } } } }