You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2007/09/22 16:20:43 UTC

svn commit: r578442 - /geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java

Author: jdillon
Date: Sat Sep 22 07:20:42 2007
New Revision: 578442

URL: http://svn.apache.org/viewvc?rev=578442&view=rev
Log:
Catch exit notifcations so that when the remote shell closes normally it dosen't cause the invoking rsh's shell to exit too

Modified:
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java?rev=578442&r1=578441&r2=578442&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java Sat Sep 22 07:20:42 2007
@@ -24,6 +24,7 @@
 import java.util.List;
 
 import jline.Terminal;
+import org.apache.geronimo.gshell.ExitNotification;
 import org.apache.geronimo.gshell.clp.Argument;
 import org.apache.geronimo.gshell.clp.Option;
 import org.apache.geronimo.gshell.command.CommandSupport;
@@ -69,7 +70,15 @@
         
         RemoteShellProxy shell = new RemoteShellProxy(client, io, terminal);
 
-        shell.run(command.toArray());
+        Object rv = SUCCESS;
+
+        try {
+            shell.run(command.toArray());
+        }
+        catch (ExitNotification n) {
+            // Make sure that we catch this notification, so that our parent shell doesn't exit when the remote shell does
+            rv = n.code;
+        }
 
         shell.close();
         
@@ -79,6 +88,6 @@
 
         io.verbose("Disconnected");
         
-        return SUCCESS;
+        return rv;
     }
 }