diff --git a/rse/plugins/org.eclipse.rse.services.ssh/src/org/eclipse/rse/internal/services/ssh/terminal/SshTerminalShell.java b/rse/plugins/org.eclipse.rse.services.ssh/src/org/eclipse/rse/internal/services/ssh/terminal/SshTerminalShell.java index 2239456fe0b..362537c7b4a 100644 --- a/rse/plugins/org.eclipse.rse.services.ssh/src/org/eclipse/rse/internal/services/ssh/terminal/SshTerminalShell.java +++ b/rse/plugins/org.eclipse.rse.services.ssh/src/org/eclipse/rse/internal/services/ssh/terminal/SshTerminalShell.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 Wind River Systems, Inc. and others. + * Copyright (c) 2008, 2011 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -9,6 +9,7 @@ * Martin Oberhuber (Wind River) - initial API and implementation * Anna Dushistova (MontaVista) - [170910] Integrate the TM Terminal View with RSE * Martin Oberhuber (Wind River) - [227320] Fix endless loop in SshTerminalShell + * Yufen Kuo (MontaVista) - [274153] Fix pipe closed with RSE *******************************************************************************/ package org.eclipse.rse.internal.services.ssh.terminal; @@ -208,7 +209,10 @@ public class SshTerminalShell extends AbstractTerminalShell { fChannel.disconnect(); } finally { fChannel = null; - isActive(); + } + Session session = fSessionProvider.getSession(); + if (session != null && !session.isConnected()) { + fSessionProvider.handleSessionLost(); } } } @@ -217,12 +221,6 @@ public class SshTerminalShell extends AbstractTerminalShell { if (fChannel != null && !fChannel.isEOF()) { return true; } - // shell is not active: check for session lost - exit(); - Session session = fSessionProvider.getSession(); - if (session != null && !session.isConnected()) { - fSessionProvider.handleSessionLost(); - } return false; } diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/shells/HostShellProcessAdapter.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/shells/HostShellProcessAdapter.java index 4effbf6ba24..37872988995 100644 --- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/shells/HostShellProcessAdapter.java +++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/shells/HostShellProcessAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 PalmSource, Inc. and others. + * Copyright (c) 2006, 2011, PalmSource, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,6 +12,7 @@ * Martin Oberhuber (Wind River) - renamed from HostShellAdapter (bug 161777) * Martin Oberhuber (Wind River) - improved Javadoc * Greg Watson (IBM) - patch for bug #252060 + * Yufen Kuo (MontaVista) - [274153] Fix pipe closed with RSE *******************************************************************************/ package org.eclipse.rse.services.shells; @@ -84,6 +85,7 @@ IHostShellOutputListener { public synchronized int exitValue() { if(hostShell.isActive()) throw new IllegalThreadStateException(); + hostShell.exit(); // No way to tell what the exit value was. // TODO it would be possible to get the exit value // when the remote process is started like this: @@ -136,7 +138,7 @@ IHostShellOutputListener { // Allow for the data from the stream to be read if it's available if (inputStream.available() != 0 || errorStream.available() != 0) throw new InterruptedException(); - + hostShell.exit(); hostShellInput.close(); hostShellError.close(); inputStream.close();