gnodet commented on code in PR #2117:
URL: https://github.com/apache/maven/pull/2117#discussion_r1967512317


##########
impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnsh/ShellInvoker.java:
##########
@@ -132,16 +134,28 @@ public boolean isCommandOrScript(String command) {
             keyMap.bind(new Reference("tailtip-toggle"), KeyMap.alt("s"));
 
             // start the shell and process input until the user quits with 
Ctrl-D
-            String line;
+            AtomicReference<Exception> failure = new AtomicReference<>();
             while (true) {
                 try {
+                    failure.set(null);
                     systemRegistry.cleanUp();
-                    line = reader.readLine(
-                            context.cwd.get().getFileName().toString() + " 
mvnsh> ",
-                            null,
-                            (MaskingCallback) null,
-                            null);
-                    systemRegistry.execute(line);
+                    Thread commandThread = new Thread(() -> {
+                        try {
+                            systemRegistry.execute(reader.readLine(
+                                    context.cwd.get().getFileName().toString() 
+ " mvnsh> ",
+                                    null,
+                                    (MaskingCallback) null,
+                                    null));
+                        } catch (Exception e) {
+                            failure.set(e);
+                        }
+                    });
+                    context.terminal.handle(Terminal.Signal.INT, signal -> 
commandThread.interrupt());

Review Comment:
   Ah, yes, that one is correct :-)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to