@SuppressWarnings("resource") // Do not close stdin 
	protected ExecInLldb execInLldb(String script) throws IOException {
		Pty pty = PtyFactory.local().openpty();
		Map<String, String> env = new HashMap<>(System.getenv());
		setPythonPath(env);
		env.put("TERM", "xterm-256color");
		ByteArrayOutputStream capture = new ByteArrayOutputStream();
		OutputStream out;
		if (SystemUtilities.isInTestingBatchMode()) {
			out = capture;
		}
		else {
			out = new TeeOutputStream(System.out, capture);
		}
		Thread pumper = new StreamPumper(pty.getParent().getInputStream(), out);
		pumper.start();
		PtySession lldbSession = pty.getChild().session(new String[] { lldbPath.toString() }, env);

		OutputStream stdin = pty.getParent().getOutputStream();
		stdin.write(script.getBytes());
		stdin.flush();
		return new ExecInLldb(pty, lldbSession, CompletableFuture.supplyAsync(() -> {
			try {
				int exitVal = lldbSession.waitExited(TIMEOUT_SECONDS, TimeUnit.SECONDS);
				Msg.info(this, "LLDB exited with code " + exitVal);
				return new LldbResult(false, exitVal, capture.toString());
			}
			catch (TimeoutException e) {
				return new LldbResult(true, -1, capture.toString());
			}
			catch (Exception e) {
				return ExceptionUtils.rethrow(e);
			}
			finally {
				try {
					pty.close();
				}
				catch (IOException e) {
					Msg.warn(this, "Couldn't close pty: " + e);
				}
				lldbSession.destroyForcibly();
				pumper.interrupt();
			}
		}), pumper);
	}
Some snapshot likely to exceed the latest
Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/AbstractLldbTraceRmiTest.java