1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-19 15:05:36 +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) - [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 * Anna Dushistova (MontaVista) - [258720] SshHostShell fails to run command if initialWorkingDirectory supplied
* Rob Stryker (JBoss) - [335059] TerminalServiceShellOutputReader logs error when hostShell.exit() is called * 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; package org.eclipse.rse.internal.services.shells;
@ -59,17 +60,21 @@ public class TerminalServiceHostShell extends AbstractHostShell {
try { try {
fTerminalShell = terminalShell; fTerminalShell = terminalShell;
String encoding = fTerminalShell.getDefaultEncoding(); String encoding = fTerminalShell.getDefaultEncoding();
BufferedReader bufReader;
if (encoding != null) { if (encoding != null) {
fStdoutHandler = new TerminalServiceShellOutputReader(this, bufReader = new BufferedReader(new InputStreamReader(fTerminalShell
new BufferedReader(new InputStreamReader(fTerminalShell .getInputStream(), encoding));
.getInputStream(), encoding)), false);
} else { } else {
fStdoutHandler = new TerminalServiceShellOutputReader(this, bufReader = new BufferedReader(new InputStreamReader(fTerminalShell
new BufferedReader(new InputStreamReader(fTerminalShell .getInputStream()));
.getInputStream())), false);
} }
fStderrHandler = new TerminalServiceShellOutputReader(this, null, //bug 356132: wait for initial output before sending any command
true); bufReader.mark(1);
bufReader.read();
bufReader.reset();
fStdoutHandler = new TerminalServiceShellOutputReader(this, bufReader, false);
fStderrHandler = new TerminalServiceShellOutputReader(this, null, true);
OutputStream outputStream = fTerminalShell.getOutputStream(); OutputStream outputStream = fTerminalShell.getOutputStream();
if (encoding != null) { if (encoding != null) {
// use specified encoding // use specified encoding