You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by GitBox <gi...@apache.org> on 2022/09/24 21:08:32 UTC

[GitHub] [karaf] awrb commented on a diff in pull request #1627: [KARAF-6321] - add configuration options to protect against CTRL-D/shell:logout exits

awrb commented on code in PR #1627:
URL: https://github.com/apache/karaf/pull/1627#discussion_r979316955


##########
shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java:
##########
@@ -451,7 +449,12 @@ private CharSequence readCommand(AtomicBoolean reading) throws UserInterruptExce
                 command = reader.getBuffer().toString();
             }
         } catch (EndOfFileException e) {
-            command = null;
+            boolean disableEofExit = (boolean) session.get(Session.DISABLE_EOF_EXIT);
+            if (disableEofExit) {
+                command = "";

Review Comment:
   I tested it manually and it works fine but I couldn't figure out a way to write a test for this (e.g. how to send CTRL-D to Karaf in a pax exam test, or some other way)



-- 
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: commits-unsubscribe@karaf.apache.org

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