karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject karaf git commit: [KARAF-3656] SSH message channel closed too early
Date Thu, 16 Apr 2015 09:34:24 GMT
Repository: karaf
Updated Branches:
  refs/heads/karaf-2.x 85e42c589 -> cda2721a2


[KARAF-3656] SSH message channel closed too early


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/cda2721a
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/cda2721a
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/cda2721a

Branch: refs/heads/karaf-2.x
Commit: cda2721a2306d3ef7373b557b452f12a62cfeb92
Parents: 85e42c5
Author: Guillaume Nodet <gnodet@gmail.com>
Authored: Thu Apr 16 11:11:35 2015 +0200
Committer: Guillaume Nodet <gnodet@gmail.com>
Committed: Thu Apr 16 11:34:19 2015 +0200

----------------------------------------------------------------------
 .../org/apache/karaf/shell/ssh/ShellCommandFactory.java   | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/cda2721a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommandFactory.java
----------------------------------------------------------------------
diff --git a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommandFactory.java b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommandFactory.java
index 43d3a49..2f227fc 100644
--- a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommandFactory.java
+++ b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommandFactory.java
@@ -64,7 +64,7 @@ public class ShellCommandFactory implements CommandFactory {
         return new ShellCommand(command);
     }
 
-    public class ShellCommand implements Command, SessionAware {
+    public class ShellCommand implements Command, Runnable, SessionAware {
 
         private String command;
         private InputStream in;
@@ -72,6 +72,7 @@ public class ShellCommandFactory implements CommandFactory {
         private OutputStream err;
         private ExitCallback callback;
         private ServerSession session;
+        private Environment env;
 
         public ShellCommand(String command) {
             this.command = command;
@@ -98,6 +99,11 @@ public class ShellCommandFactory implements CommandFactory {
         }
 
         public void start(final Environment env) throws IOException {
+            this.env = env;
+            new Thread(this).start();
+        }
+
+        public void run() {
             int exitStatus = 0;
             final CommandSession commandSession = commandProcessor.createSession(in, new
PrintStream(out), new PrintStream(err));
             try {
@@ -171,7 +177,7 @@ public class ShellCommandFactory implements CommandFactory {
                 }
             } catch (Exception e) {
                 exitStatus = 1;
-                throw (IOException) new IOException("Unable to start shell").initCause(e);
+                LOGGER.error("Unable to start shell", e);
             } finally {
                 close(in, out, err);
                 commandSession.close();


Mime
View raw message