From 25d249c28dfa37447a3e88bb699afafd3c52107d Mon Sep 17 00:00:00 2001 From: Janne Valkealahti Date: Wed, 18 Jan 2023 09:03:03 +0000 Subject: [PATCH] Exclude ExitRequest from error handling - Don't try to handle ExitRequest exception with error handling so that we're able to break out from a run loop with interactive shell. - Fixes #624 --- .../src/main/java/org/springframework/shell/Shell.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-shell-core/src/main/java/org/springframework/shell/Shell.java b/spring-shell-core/src/main/java/org/springframework/shell/Shell.java index fd73323e..a123dc9d 100644 --- a/spring-shell-core/src/main/java/org/springframework/shell/Shell.java +++ b/spring-shell-core/src/main/java/org/springframework/shell/Shell.java @@ -265,7 +265,7 @@ public class Shell { finally { Signals.unregister("INT", sh); } - if (e != null) { + if (e != null && !(e instanceof ExitRequest)) { try { CommandHandlingResult processException = processException(commandExceptionResolvers, e); processExceptionNonInt = processException;