mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 00:35:49 +02:00
[411343] Provide access to readers in host shell implementation for
synchronous running commands
This commit is contained in:
parent
b14baa94e3
commit
28304f4dec
3 changed files with 23 additions and 10 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.rse.services;singleton:=true
|
Bundle-SymbolicName: org.eclipse.rse.services;singleton:=true
|
||||||
Bundle-Version: 3.2.200.qualifier
|
Bundle-Version: 3.3.0.qualifier
|
||||||
Bundle-Activator: org.eclipse.rse.internal.services.Activator
|
Bundle-Activator: org.eclipse.rse.internal.services.Activator
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
* 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
|
* Martin Oberhuber (Wind River) - [356132] wait for initial output
|
||||||
|
* Ioana Grigoropol (Intel) - [411343] Provide access to readers in host shell
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.services.shells;
|
package org.eclipse.rse.internal.services.shells;
|
||||||
|
@ -47,7 +48,7 @@ public class TerminalServiceHostShell extends AbstractHostShell {
|
||||||
public static final String SHELL_INVOCATION = ">"; //$NON-NLS-1$
|
public static final String SHELL_INVOCATION = ">"; //$NON-NLS-1$
|
||||||
|
|
||||||
ITerminalShell fTerminalShell;
|
ITerminalShell fTerminalShell;
|
||||||
|
BufferedReader fBufReader;
|
||||||
private TerminalServiceShellOutputReader fStdoutHandler;
|
private TerminalServiceShellOutputReader fStdoutHandler;
|
||||||
|
|
||||||
private TerminalServiceShellOutputReader fStderrHandler;
|
private TerminalServiceShellOutputReader fStderrHandler;
|
||||||
|
@ -60,21 +61,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) {
|
||||||
bufReader = new BufferedReader(new InputStreamReader(fTerminalShell
|
fBufReader = new BufferedReader(new InputStreamReader(fTerminalShell
|
||||||
.getInputStream(), encoding));
|
.getInputStream(), encoding));
|
||||||
} else {
|
} else {
|
||||||
bufReader = new BufferedReader(new InputStreamReader(fTerminalShell
|
fBufReader = new BufferedReader(new InputStreamReader(fTerminalShell
|
||||||
.getInputStream()));
|
.getInputStream()));
|
||||||
}
|
}
|
||||||
//bug 356132: wait for initial output before sending any command
|
//bug 356132: wait for initial output before sending any command
|
||||||
//FIXME this should likely move into the TerminalServiceShellWriterThread, so wait can be canceled
|
//FIXME this should likely move into the TerminalServiceShellWriterThread, so wait can be canceled
|
||||||
bufReader.mark(1);
|
fBufReader.mark(1);
|
||||||
bufReader.read();
|
fBufReader.read();
|
||||||
bufReader.reset();
|
fBufReader.reset();
|
||||||
|
|
||||||
fStdoutHandler = new TerminalServiceShellOutputReader(this, bufReader, false);
|
fStdoutHandler = new TerminalServiceShellOutputReader(this, fBufReader, false);
|
||||||
fStderrHandler = new TerminalServiceShellOutputReader(this, null, true);
|
fStderrHandler = new TerminalServiceShellOutputReader(this, null, true);
|
||||||
OutputStream outputStream = fTerminalShell.getOutputStream();
|
OutputStream outputStream = fTerminalShell.getOutputStream();
|
||||||
if (encoding != null) {
|
if (encoding != null) {
|
||||||
|
@ -170,4 +171,7 @@ public class TerminalServiceHostShell extends AbstractHostShell {
|
||||||
return "echo $PWD'>'"; //$NON-NLS-1$
|
return "echo $PWD'>'"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BufferedReader getReader(boolean isErrorReader) {
|
||||||
|
return fBufReader;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,13 @@
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
* Ioana Grigoropol (Intel) - [411343] Provide access to readers in host shell
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.services.shells;
|
package org.eclipse.rse.services.shells;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
|
||||||
|
|
||||||
public abstract class AbstractHostShell implements IHostShell
|
public abstract class AbstractHostShell implements IHostShell
|
||||||
{
|
{
|
||||||
|
@ -33,5 +35,12 @@ public abstract class AbstractHostShell implements IHostShell
|
||||||
errReader.addOutputListener(listener);
|
errReader.addOutputListener(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 3.3
|
||||||
|
*/
|
||||||
|
public BufferedReader getReader(boolean isErrorReader) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue