mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 09:55:29 +02:00
[252060] Created junit test to reproduce the issue.
This commit is contained in:
parent
cd82a6532a
commit
12dc5146ea
1 changed files with 33 additions and 0 deletions
|
@ -11,6 +11,9 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.rse.tests.subsystems.shells;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
@ -22,6 +25,7 @@ import org.eclipse.rse.core.RSECorePlugin;
|
|||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.services.shells.HostShellProcessAdapter;
|
||||
import org.eclipse.rse.services.shells.IHostOutput;
|
||||
import org.eclipse.rse.services.shells.IHostShell;
|
||||
import org.eclipse.rse.services.shells.IShellService;
|
||||
|
@ -173,4 +177,33 @@ public class ShellServiceTest extends RSEBaseConnectionTestCase {
|
|||
assertTrue(matchFound);
|
||||
}
|
||||
|
||||
public void testRunCommandViaHostShellProcessAdapter() throws Exception {
|
||||
IHostShell hostShell = null;
|
||||
hostShell = shellService.runCommand("", "echo test"
|
||||
+ shellSubSystem.getParentRemoteCmdSubSystemConfiguration()
|
||||
.getCommandSeparator() + " exit", new String[] {}, mon);
|
||||
HostShellProcessAdapter p = null;
|
||||
try {
|
||||
p = new HostShellProcessAdapter(hostShell);
|
||||
} catch (Exception e) {
|
||||
fail(e.getMessage());
|
||||
return;
|
||||
}
|
||||
BufferedReader bufferReader = new BufferedReader(new InputStreamReader(
|
||||
p.getInputStream()));
|
||||
|
||||
String nextLine;
|
||||
boolean matchFound = false;
|
||||
try {
|
||||
while ((nextLine = bufferReader.readLine()) != null) {
|
||||
matchFound = nextLine.equals("test");
|
||||
}
|
||||
bufferReader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
fail(e.getMessage());
|
||||
}
|
||||
assertTrue(matchFound);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue