1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-02 22:55:26 +02:00

Bug 356132 - TerminalServiceHostShell with SshTerminalShell on slower targets will hang the shell when writeToShell with commands on shell that is not ready to accept command yet

This commit is contained in:
Martin Oberhuber 2011-09-14 16:36:03 +00:00
parent 722b76e819
commit f6e5dc2b7a

View file

@ -21,6 +21,7 @@
* Anna Dushistova (MontaVista) - [240523] [rseterminals] Provide a generic adapter factory that adapts any ITerminalService to an IShellService
* Anna Dushistova (MontaVista) - [258720] SshHostShell fails to run command if initialWorkingDirectory supplied
* Rob Stryker (JBoss) - [335059] TerminalServiceShellOutputReader logs error when hostShell.exit() is called
* Martin Oberhuber (Wind River) - [356132] wait for initial output
*******************************************************************************/
package org.eclipse.rse.internal.services.shells;
@ -59,17 +60,21 @@ public class TerminalServiceHostShell extends AbstractHostShell {
try {
fTerminalShell = terminalShell;
String encoding = fTerminalShell.getDefaultEncoding();
BufferedReader bufReader;
if (encoding != null) {
fStdoutHandler = new TerminalServiceShellOutputReader(this,
new BufferedReader(new InputStreamReader(fTerminalShell
.getInputStream(), encoding)), false);
bufReader = new BufferedReader(new InputStreamReader(fTerminalShell
.getInputStream(), encoding));
} else {
fStdoutHandler = new TerminalServiceShellOutputReader(this,
new BufferedReader(new InputStreamReader(fTerminalShell
.getInputStream())), false);
bufReader = new BufferedReader(new InputStreamReader(fTerminalShell
.getInputStream()));
}
fStderrHandler = new TerminalServiceShellOutputReader(this, null,
true);
//bug 356132: wait for initial output before sending any command
bufReader.mark(1);
bufReader.read();
bufReader.reset();
fStdoutHandler = new TerminalServiceShellOutputReader(this, bufReader, false);
fStderrHandler = new TerminalServiceShellOutputReader(this, null, true);
OutputStream outputStream = fTerminalShell.getOutputStream();
if (encoding != null) {
// use specified encoding