1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-25 18:05:33 +02:00

Fix ssh remote cmd invocation and environment variable setup according to API

This commit is contained in:
Martin Oberhuber 2006-10-27 02:12:56 +00:00
parent 5aa266c4ce
commit ea3ce27d22
2 changed files with 8 additions and 5 deletions

View file

@ -39,6 +39,8 @@ import org.eclipse.rse.services.ssh.ISshSessionProvider;
*/ */
public class SshHostShell extends AbstractHostShell implements IHostShell { public class SshHostShell extends AbstractHostShell implements IHostShell {
public static final String SHELL_INVOCATION = ">"; //$NON-NLS-1$
private ISshSessionProvider fSessionProvider; private ISshSessionProvider fSessionProvider;
private Channel fChannel; private Channel fChannel;
private SshShellOutputReader fStdoutHandler; private SshShellOutputReader fStdoutHandler;
@ -54,7 +56,7 @@ public class SshHostShell extends AbstractHostShell implements IHostShell {
////By default, jsch always creates a vt100 connection sized ////By default, jsch always creates a vt100 connection sized
////80x24 / 640x480 (dimensions can be changed). ////80x24 / 640x480 (dimensions can be changed).
////I wonder whether jsch could give us a dumb terminal? ////I wonder whether jsch could give us a dumb terminal?
//if(fChannel instanceof ChannelShell) { //if(commandToRun!=null && !commandToRun.equals(SHELL_INVOCATION) & (fChannel instanceof ChannelShell)) {
// ((ChannelShell)fChannel).setPty(false); // ((ChannelShell)fChannel).setPty(false);
//} //}
@ -93,6 +95,9 @@ public class SshHostShell extends AbstractHostShell implements IHostShell {
) { ) {
writeToShell("cd "+initialWorkingDirectory); //$NON-NLS-1$ writeToShell("cd "+initialWorkingDirectory); //$NON-NLS-1$
} }
if(commandToRun!=null && commandToRun.length()>0 && !commandToRun.equals(SHELL_INVOCATION)) {
writeToShell(commandToRun);
}
} catch(Exception e) { } catch(Exception e) {
//TODO Forward exception to RSE properly //TODO Forward exception to RSE properly
e.printStackTrace(); e.printStackTrace();
@ -111,7 +116,7 @@ public class SshHostShell extends AbstractHostShell implements IHostShell {
protected void start(IProgressMonitor monitor) protected void start(IProgressMonitor monitor)
{ {
//TODO Move stuff from constructor to here //TODO Move stuff from constructor to here
//TODO Set up environment variables fro proper prompting, e.g. like dstore //TODO Set up environment variables for proper prompting, e.g. like dstore
//varTable.put("PS1","$PWD/>"); //varTable.put("PS1","$PWD/>");
//varTable.put("COLUMNS","256"); //varTable.put("COLUMNS","256");
//alias ls='ls -1' //alias ls='ls -1'

View file

@ -31,7 +31,6 @@ import org.eclipse.rse.services.ssh.SshServiceResources;
*/ */
public class SshShellService implements ISshService, IShellService { public class SshShellService implements ISshService, IShellService {
private static final String SHELL_INVOCATION = ">"; //$NON-NLS-1$
private ISshSessionProvider fSessionProvider; private ISshSessionProvider fSessionProvider;
public SshShellService(ISshSessionProvider sessionProvider) { public SshShellService(ISshSessionProvider sessionProvider) {
@ -48,7 +47,7 @@ public class SshShellService implements ISshService, IShellService {
public IHostShell launchShell(IProgressMonitor monitor, public IHostShell launchShell(IProgressMonitor monitor,
String initialWorkingDirectory, String encoding, String initialWorkingDirectory, String encoding,
String[] environment) { String[] environment) {
SshHostShell hostShell = new SshHostShell(fSessionProvider, initialWorkingDirectory, SHELL_INVOCATION, encoding, environment); SshHostShell hostShell = new SshHostShell(fSessionProvider, initialWorkingDirectory, SshHostShell.SHELL_INVOCATION, encoding, environment);
return hostShell; return hostShell;
} }
@ -59,7 +58,6 @@ public class SshShellService implements ISshService, IShellService {
return runCommand(monitor, initialWorkingDirectory, command, defaultEncoding, environment); return runCommand(monitor, initialWorkingDirectory, command, defaultEncoding, environment);
} }
//TODO command is ignored by SshHostShell for now (just like DStoreHostShell).
public IHostShell runCommand(IProgressMonitor monitor, public IHostShell runCommand(IProgressMonitor monitor,
String initialWorkingDirectory, String command, String encoding, String initialWorkingDirectory, String command, String encoding,
String[] environment) { String[] environment) {