Backport bugfixes to jline-3.x#1842
Conversation
When running on JDK 21, loading the FFM terminal provider (compiled for Java 22) throws UnsupportedClassVersionError, which is a LinkageError (an Error, not an Exception). The catch clause only caught Exception, letting the error escape. Catch LinkageError as well so provider loading failures are properly wrapped in IOException and handled gracefully by the fallback logic.
…ixes #1766) Only call TerminalBuilder.providers() when the jansi.providers system property is actually set. Passing null was a no-op anyway, and the unconditional call causes NoSuchMethodError when an older jline-terminal jar without the providers() method is loaded first on the classpath.
Object.wait(timeout) can return due to spurious wakeups, so it must be called inside a while loop that re-checks the condition. Use a deadline-based loop to correctly handle the remaining timeout.
The Size fields are int but setColumns()/setRows() silently truncated values via (short) casts since the class was created in 2016. This served no purpose — the truncated value was stored back into an int field, so there was no memory saving, only silent data loss for values above 32767.
* Fix AttributedStyle color chaining * Update terminal/src/test/java/org/jline/utils/AttributedStyleTest.java * Update terminal/src/test/java/org/jline/utils/AttributedStyleTest.java --------- Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
…1813) When a LineDisciplineTerminal is created with a null masterOutput (e.g. via TerminalBuilder.builder().system(false).build()), closing the terminal triggers a NullPointerException in FilteringOutputStream's flush() and close() methods. Add null guards for masterOutput in all code paths.
…#1808) (#1817) On macOS, closing a file descriptor from one thread does not reliably unblock a read() blocked on the same fd in another thread. The pumpOut thread in PosixPtyTerminal blocks on masterInput.read(), and pty.close() was unable to unblock it. Fix by closing the slave output first, which signals EOF on the master side via the kernel's PTY layer, reliably unblocking pumpOut on all platforms. Also close masterInput directly before pty.close(). Restore try-with-resources in FfmTest now that terminals close cleanly.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|



Summary
Cherry-picked commits