From 9d6e233f65844b1e6306712b720b23b89cd2d6a9 Mon Sep 17 00:00:00 2001 From: ghidraffe <108089404+ghidraffe@users.noreply.github.com> Date: Thu, 12 Feb 2026 08:54:16 -0500 Subject: [PATCH] fix another Pty windows test from hanging --- .../java/ghidra/pty/windows/ConPtyTest.java | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/Ghidra/Framework/Pty/src/test/java/ghidra/pty/windows/ConPtyTest.java b/Ghidra/Framework/Pty/src/test/java/ghidra/pty/windows/ConPtyTest.java index 55e64736f4..d85ab6bd8a 100644 --- a/Ghidra/Framework/Pty/src/test/java/ghidra/pty/windows/ConPtyTest.java +++ b/Ghidra/Framework/Pty/src/test/java/ghidra/pty/windows/ConPtyTest.java @@ -108,11 +108,29 @@ public class ConPtyTest extends AbstractPtyTest { "echo This line is cleary much, much, much, much, much, much, much, much, much " + " longer than 80 characters"); writer.flush(); - String line; - do { - line = reader.readLine(); - } - while (!"test".equals(line)); + + // set up reading cmd output on a thread since "readLine" is blocking + Thread t = new Thread(() -> { + String line; + try { + do { + line = reader.readLine(); + } + while (!"test".equals(line)); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + }); + + t.setDaemon(true); + t.start(); + + writer.println("exit 3"); + writer.flush(); + + assertEquals(3, gdb.waitExited()); + assertFalse("Content read successfully from the cmd", t.isAlive()); } }