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

[191599] use shell encoding specified

This commit is contained in:
David McKnight 2007-07-11 18:58:28 +00:00
parent 2a18d44c77
commit 9c9e01baec
3 changed files with 9 additions and 44 deletions

View file

@ -74,7 +74,6 @@ public class CommandMinerThread extends MinerThread
private boolean _isDone; private boolean _isDone;
private boolean _isWindows; private boolean _isWindows;
private boolean _isTTY; private boolean _isTTY;
private boolean _isOS400 = false;
private boolean _didInitialCWDQuery = false; private boolean _didInitialCWDQuery = false;
private CommandMiner.CommandMinerDescriptors _descriptors; private CommandMiner.CommandMinerDescriptors _descriptors;
@ -100,13 +99,6 @@ public class CommandMinerThread extends MinerThread
_patterns.refresh(_invocation); _patterns.refresh(_invocation);
if (theOS.toLowerCase().startsWith("os/400")) //$NON-NLS-1$
{
_isOS400 = true;
}
if (theOS.toLowerCase().startsWith("z")) //$NON-NLS-1$ if (theOS.toLowerCase().startsWith("z")) //$NON-NLS-1$
{ {
System.setProperty("dstore.stdin.encoding","Cp037"); //$NON-NLS-1$ //$NON-NLS-2$ System.setProperty("dstore.stdin.encoding","Cp037"); //$NON-NLS-1$ //$NON-NLS-2$
@ -153,7 +145,7 @@ public class CommandMinerThread extends MinerThread
{ {
_isTTY = false; _isTTY = false;
} }
_patterns.setIsTerminal(_isTTY && !_isOS400); _patterns.setIsTerminal(_isTTY);
String property = "SHELL="; //$NON-NLS-1$ String property = "SHELL="; //$NON-NLS-1$
@ -169,10 +161,6 @@ public class CommandMinerThread extends MinerThread
theShell = "sh"; //$NON-NLS-1$ theShell = "sh"; //$NON-NLS-1$
} }
} }
if (_isOS400)
{
theShell = "/QOpenSys/usr/bin/sh";//var.substring(property.length(), var.length()); //$NON-NLS-1$
}
} }
@ -237,12 +225,6 @@ public class CommandMinerThread extends MinerThread
args[1] = theShell; args[1] = theShell;
args[2] = "-c"; //$NON-NLS-1$ args[2] = "-c"; //$NON-NLS-1$
args[3] = _invocation; args[3] = _invocation;
/*
for (int i = 0; i < inv.length; i++)
{
args[3 + i] = inv[i];
}
*/
_theProcess = Runtime.getRuntime().exec(args, env, theDirectory); _theProcess = Runtime.getRuntime().exec(args, env, theDirectory);
} }
@ -253,12 +235,7 @@ public class CommandMinerThread extends MinerThread
args[0] = theShell; args[0] = theShell;
args[1] = "-c"; //$NON-NLS-1$ args[1] = "-c"; //$NON-NLS-1$
args[2] = _invocation; args[2] = _invocation;
/*
for (int i = 0; i < inv.length; i++)
{
args[2 + i] = inv[i];
}
*/
_theProcess = Runtime.getRuntime().exec(args, env, theDirectory); _theProcess = Runtime.getRuntime().exec(args, env, theDirectory);
} }
@ -487,14 +464,7 @@ public class CommandMinerThread extends MinerThread
} }
else if (input.equals("#enter")) //$NON-NLS-1$ else if (input.equals("#enter")) //$NON-NLS-1$
{ {
if (_isOS400) writer.newLine();
{
writer.write("\r"); //$NON-NLS-1$
}
else
{
writer.newLine();
}
writer.flush(); writer.flush();
return; return;
} }
@ -531,15 +501,7 @@ public class CommandMinerThread extends MinerThread
} }
writer.write(input); writer.write(input);
writer.newLine();
if (_isOS400)
{
writer.write("\r"); //$NON-NLS-1$
}
else
{
writer.newLine();
}
writer.flush(); writer.flush();

View file

@ -14,6 +14,7 @@
* Contributors: * Contributors:
* Javier Montalvo Orús (Symbian) - 138619: Fix codepage on Win2K * Javier Montalvo Orús (Symbian) - 138619: Fix codepage on Win2K
* Lothar Werzinger (Tradescape) - 161838: Support terminating local shells * Lothar Werzinger (Tradescape) - 161838: Support terminating local shells
* David McKnight (IBM) - [189387] Use specified encoding for shell output
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.services.local.shells; package org.eclipse.rse.internal.services.local.shells;
@ -247,7 +248,8 @@ public class LocalShellThread extends Thread
} }
} }
_stdInput = new BufferedReader(new InputStreamReader(_theProcess.getInputStream())); _stdInput = new BufferedReader(new InputStreamReader(_theProcess.getInputStream(), _encoding));
_stdError = new BufferedReader(new InputStreamReader(_theProcess.getErrorStream())); _stdError = new BufferedReader(new InputStreamReader(_theProcess.getErrorStream()));
} }

View file

@ -13,6 +13,7 @@
* *
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - Adapted from LocalHostShell. * Martin Oberhuber (Wind River) - Adapted from LocalHostShell.
* David McKnight (IBM) - [191599] Use the remote encoding specified in the host property page
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.services.ssh.shell; package org.eclipse.rse.internal.services.ssh.shell;
@ -80,7 +81,7 @@ public class SshHostShell extends AbstractHostShell implements IHostShell {
((ChannelShell)fChannel).setEnv(envTable); ((ChannelShell)fChannel).setEnv(envTable);
} }
fStdoutHandler = new SshShellOutputReader(this, new BufferedReader(new InputStreamReader(fChannel.getInputStream())), false); fStdoutHandler = new SshShellOutputReader(this, new BufferedReader(new InputStreamReader(fChannel.getInputStream(), encoding)), false);
fStderrHandler = new SshShellOutputReader(this, null,true); fStderrHandler = new SshShellOutputReader(this, null,true);
OutputStream outputStream = fChannel.getOutputStream(); OutputStream outputStream = fChannel.getOutputStream();
//TODO check if encoding or command to execute needs to be considered //TODO check if encoding or command to execute needs to be considered