Details
Description
if we run client script like
./bin/client "list; logout; list"
we get exception from client side like
Error executing command: org.apache.karaf.shell.console.CloseShellException
and in the karaf.log we get exception like
Exception caught while executing command org.apache.karaf.shell.console.CloseShellException at org.apache.karaf.shell.commands.LogoutAction.doExecute(LogoutAction.java:28) at org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:33) at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35) at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_71] at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_71] at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:54) at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:119) at org.apache.karaf.shell.console.commands.$BlueprintCommand218724865.execute(Unknown Source) at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78) at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:477) at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:403) at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108) at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183) at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120) at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:92) at org.apache.karaf.shell.ssh.ShellCommandFactory$ShellCommand$1.run(ShellCommandFactory.java:119) at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_71] at org.apache.karaf.jaas.modules.JaasHelper.doAs(JaasHelper.java:67) at org.apache.karaf.shell.ssh.ShellCommandFactory$ShellCommand.start(ShellCommandFactory.java:115) at org.apache.sshd.server.channel.ChannelSession.handleExec(ChannelSession.java:422)[52:org.apache.sshd.core:0.12.0] at org.apache.sshd.server.channel.ChannelSession.handleRequest(ChannelSession.java:304)[52:org.apache.sshd.core:0.12.0] at org.apache.sshd.server.channel.ChannelSession$ChannelSessionRequestHandler.process(ChannelSession.java:576)[52:org.apache.sshd.core:0.12.0] at org.apache.sshd.server.channel.ChannelSession$ChannelSessionRequestHandler.process(ChannelSession.java:574)[52:org.apache.sshd.core:0.12.0] at org.apache.sshd.common.channel.AbstractChannel.handleRequest(AbstractChannel.java:96)[52:org.apache.sshd.core:0.12.0] at org.apache.sshd.common.session.AbstractConnectionService.channelRequest(AbstractConnectionService.java:261)[52:org.apache.sshd.core:0.12.0] at org.apache.sshd.common.session.AbstractConnectionService.process(AbstractConnectionService.java:139)[52:org.apache.sshd.core:0.12.0] at org.apache.sshd.common.session.AbstractSession.doHandleMessage(AbstractSession.java:399)[52:org.apache.sshd.core:0.12.0] at org.apache.sshd.common.session.AbstractSession.handleMessage(AbstractSession.java:295)[52:org.apache.sshd.core:0.12.0] at org.apache.sshd.common.session.AbstractSession.decode(AbstractSession.java:731)[52:org.apache.sshd.core:0.12.0] at org.apache.sshd.common.session.AbstractSession.messageReceived(AbstractSession.java:277)[52:org.apache.sshd.core:0.12.0] at org.apache.sshd.common.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:54)[52:org.apache.sshd.core:0.12.0] at org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:187)[52:org.apache.sshd.core:0.12.0] at org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:173)[52:org.apache.sshd.core:0.12.0] at org.apache.sshd.common.io.nio2.Nio2CompletionHandler$1.run(Nio2CompletionHandler.java:32) at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_71] at org.apache.sshd.common.io.nio2.Nio2CompletionHandler.completed(Nio2CompletionHandler.java:30)[52:org.apache.sshd.core:0.12.0] at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)[:1.7.0_71] at sun.nio.ch.Invoker$2.run(Invoker.java:218)[:1.7.0_71] at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)[:1.7.0_71] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_71] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_71] at java.lang.Thread.run(Thread.java:745)[:1.7.0_71]
we should catch CloseShellException and quit shell silently without throwing annoying exception