From 35009760d9adda46208c0eba350899b576ffaa6f Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 24 Oct 2023 22:43:34 +0200 Subject: [PATCH] Make sure the thread is not in an interrupted state when cleanup up (fixes #590) --- .../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(); + } } } }