1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 23:05:47 +02:00

[371142] Keep shell alive while there is anything in a pipe.

This commit is contained in:
Anna Dushistova 2012-05-02 20:57:25 +00:00
parent 3d5e188f9b
commit a8b1e029bc

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008, 2011 Wind River Systems, Inc. and others. * Copyright (c) 2008, 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -11,6 +11,7 @@
* Martin Oberhuber (Wind River) - [227320] Fix endless loop in SshTerminalShell * Martin Oberhuber (Wind River) - [227320] Fix endless loop in SshTerminalShell
* Yufen Kuo (MontaVista) - [274153] Fix pipe closed with RSE * Yufen Kuo (MontaVista) - [274153] Fix pipe closed with RSE
* Anna Dushistova (Mentor Graphics) - Returned "session lost" handling to isActive() * Anna Dushistova (Mentor Graphics) - Returned "session lost" handling to isActive()
* Anna Dushistova (MontaVista) - [371142] [shells][terminals] Keep shell alive while there is anything in a pipe
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.services.ssh.terminal; package org.eclipse.rse.internal.services.ssh.terminal;
@ -216,7 +217,13 @@ public class SshTerminalShell extends AbstractTerminalShell {
} }
public boolean isActive() { public boolean isActive() {
if (fChannel != null && !fChannel.isEOF()) { boolean hasInput = false;
try {
hasInput = getInputStream().available() > 0;
} catch (IOException e) {
// Do nothing since we are just polling
}
if (fChannel != null && (!fChannel.isEOF() || hasInput)) {
return true; return true;
} }
// shell is not active: check for session lost // shell is not active: check for session lost