From 9a216cab00a5c3f8458c1a4454236c1eb94b0182 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 24 Oct 2023 23:36:17 +0200 Subject: [PATCH] Make sure the thread is not in an interrupted state when cleanup up (fixes #590) (#883) --- .../src/main/java/org/jline/reader/impl/LineReaderImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reader/src/main/java/org/jline/reader/impl/LineReaderImpl.java b/reader/src/main/java/org/jline/reader/impl/LineReaderImpl.java index e2d971f48..778c53869 100644 --- a/reader/src/main/java/org/jline/reader/impl/LineReaderImpl.java +++ b/reader/src/main/java/org/jline/reader/impl/LineReaderImpl.java @@ -763,6 +763,7 @@ && getLastBinding().charAt(0) == originalAttributes.getControlChar(ControlChar.V throw e; } } finally { + boolean interrupted = Thread.interrupted(); try { lock.lock(); @@ -784,6 +785,9 @@ && getLastBinding().charAt(0) == originalAttributes.getControlChar(ControlChar.V } finally { lock.unlock(); startedReading.set(false); + if (interrupted) { + Thread.currentThread().interrupt(); + } } } }