You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/09/24 21:09:00 UTC

[jira] [Commented] (KARAF-6321) Be able to "control/enable/disable" CTRL-D and logout in the shell

    [ https://issues.apache.org/jira/browse/KARAF-6321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17609055#comment-17609055 ] 

ASF GitHub Bot commented on KARAF-6321:
---------------------------------------

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)





> Be able to "control/enable/disable" CTRL-D and logout in the shell
> ------------------------------------------------------------------
>
>                 Key: KARAF-6321
>                 URL: https://issues.apache.org/jira/browse/KARAF-6321
>             Project: Karaf
>          Issue Type: Improvement
>          Components: karaf
>            Reporter: Jean-Baptiste Onofré
>            Priority: Major
>
> By default, when running Karaf in foreground, CTRL-D just stops Karaf container. It could be done by mistake.
> It would be great to be able to control behavior of CTRL-D and {{shell:logout}} via {{etc/org.apache.karaf.shell.cfg}} at least be able to disable CTRL-D or {{logout}} to allow users to use another command or cleanly use {{halt}} one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)