diff --git a/builtins/src/main/java/org/jline/builtins/SystemRegistryImpl.java b/builtins/src/main/java/org/jline/builtins/SystemRegistryImpl.java index bc24e4539..9e8fc8cbd 100644 --- a/builtins/src/main/java/org/jline/builtins/SystemRegistryImpl.java +++ b/builtins/src/main/java/org/jline/builtins/SystemRegistryImpl.java @@ -1080,8 +1080,8 @@ public Object execute(String line) throws Exception { consoleEngine().println(er.result()); out = null; boolean success = er.status() == 0 ? true : false; - if ( (cmd.pipe().equals(pipeName.get(Pipe.OR)) && success) - || (cmd.pipe().equals(pipeName.get(Pipe.AND)) && !success)) { + if ((cmd.pipe().equals(pipeName.get(Pipe.OR)) && success) + || (cmd.pipe().equals(pipeName.get(Pipe.AND)) && !success)) { break; } } diff --git a/demo/src/main/java/org/jline/demo/Repl.java b/demo/src/main/java/org/jline/demo/Repl.java index 031c51e7d..dd8b92abc 100644 --- a/demo/src/main/java/org/jline/demo/Repl.java +++ b/demo/src/main/java/org/jline/demo/Repl.java @@ -56,6 +56,8 @@ import org.jline.script.GroovyEngine; import org.jline.terminal.Terminal; import org.jline.terminal.TerminalBuilder; +import org.jline.terminal.Terminal.Signal; +import org.jline.terminal.Terminal.SignalHandler; import org.jline.utils.InfoCmp; import org.jline.utils.InfoCmp.Capability; import org.jline.utils.OSUtils; @@ -449,6 +451,8 @@ public static void main(String[] args) { parser.setEscapeChars(null); parser.setRegexCommand("[:]{0,1}[a-zA-Z!]{1,}\\S*"); // change default regex to support shell commands Terminal terminal = TerminalBuilder.builder().build(); + Thread executeThread = Thread.currentThread(); + terminal.handle(Signal.INT, signal -> executeThread.interrupt()); // // ScriptEngine and command registeries //