From fb7fe2edba3f9afe1e96240fc5a04f53fc1e6c89 Mon Sep 17 00:00:00 2001 From: Martin Oberhuber < martin.oberhuber@windriver.com> Date: Mon, 9 Mar 2009 10:37:51 +0000 Subject: [PATCH] [267402] [telnet] "launch shell" takes forever --- releng/org.eclipse.rse.build/maps/rse.map | 4 ++-- .../telnet/terminal/TelnetTerminalShell.java | 10 +++++--- .../services/shells/TerminalShellService.java | 24 ++++++++++--------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/releng/org.eclipse.rse.build/maps/rse.map b/releng/org.eclipse.rse.build/maps/rse.map index ac5815ce571..8d580e30b61 100644 --- a/releng/org.eclipse.rse.build/maps/rse.map +++ b/releng/org.eclipse.rse.build/maps/rse.map @@ -41,8 +41,8 @@ plugin@org.eclipse.rse.services.dstore=v200903051130,:pserver:anonymous:none@dev plugin@org.eclipse.rse.services.files.ftp=v200903070130,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.services.files.ftp plugin@org.eclipse.rse.services.local=v200812041630,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.services.local plugin@org.eclipse.rse.services.ssh=v200902011800,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.services.ssh -plugin@org.eclipse.rse.services.telnet=v200903070130,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.services.telnet -plugin@org.eclipse.rse.services=v200903070130,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.services +plugin@org.eclipse.rse.services.telnet=v200903091037,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.services.telnet +plugin@org.eclipse.rse.services=v200903091037,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.services plugin@org.eclipse.rse.shells.ui=v200902011800,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.shells.ui plugin@org.eclipse.rse.subsystems.files.core=v200903051130,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.subsystems.files.core plugin@org.eclipse.rse.subsystems.files.dstore=v200903051130,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.rse/plugins/org.eclipse.rse.subsystems.files.dstore diff --git a/rse/plugins/org.eclipse.rse.services.telnet/src/org/eclipse/rse/internal/services/telnet/terminal/TelnetTerminalShell.java b/rse/plugins/org.eclipse.rse.services.telnet/src/org/eclipse/rse/internal/services/telnet/terminal/TelnetTerminalShell.java index 9084d212d74..2cf42c98814 100644 --- a/rse/plugins/org.eclipse.rse.services.telnet/src/org/eclipse/rse/internal/services/telnet/terminal/TelnetTerminalShell.java +++ b/rse/plugins/org.eclipse.rse.services.telnet/src/org/eclipse/rse/internal/services/telnet/terminal/TelnetTerminalShell.java @@ -10,6 +10,7 @@ * Anna Dushistova (MontaVista) - [170910] Integrate the TM Terminal View with RSE * Martin Oberhuber (Wind River) - [227320] Fix endless loop in TelnetTerminalShell * Anna Dushistova (MontaVista) - [240523] [rseterminals] Provide a generic adapter factory that adapts any ITerminalService to an IShellService + * Martin Oberhuber (Wind River) - [267402] [telnet] "launch shell" takes forever *******************************************************************************/ package org.eclipse.rse.internal.services.telnet.terminal; @@ -91,14 +92,17 @@ public class TelnetTerminalShell extends AbstractTerminalShell { || System.getProperty("os.name").toLowerCase().startsWith( //$NON-NLS-1$ "linux");//$NON-NLS-1$ fEncoding = encoding; - fTelnetClient = new TelnetClient(ptyType); + if (ptyType == null) { + fTelnetClient = new TelnetClient(); + } else { + fTelnetClient = new TelnetClient(ptyType); + fTelnetClient.addOptionHandler(new TerminalTypeOptionHandler(ptyType, true, true, true, true)); + } // request remote echo, but accept local if desired fTelnetClient.addOptionHandler(new EchoOptionHandler(false, true, true, true)); fTelnetClient.addOptionHandler(new SuppressGAOptionHandler(true, true, true, true)); - fTelnetClient.addOptionHandler(new TerminalTypeOptionHandler( - ptyType, true, true, true, true)); fTelnetClient = fSessionProvider.loginTelnetClient(fTelnetClient, new NullProgressMonitor()); fOutputStream = fTelnetClient.getOutputStream(); diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/internal/services/shells/TerminalShellService.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/internal/services/shells/TerminalShellService.java index ddf81aaf4af..05a7fbde080 100644 --- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/internal/services/shells/TerminalShellService.java +++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/internal/services/shells/TerminalShellService.java @@ -20,6 +20,7 @@ * Anna Dushistova (MontaVista) - adapted from SshShellService * Anna Dushistova (MontaVista) - [240523] [rseterminals] Provide a generic adapter factory that adapts any ITerminalService to an IShellService * Anna Dushistova (MontaVista) - [261478] Remove SshShellService, SshHostShell (or deprecate and schedule for removal in 3.2) + * Martin Oberhuber (Wind River) - [267402] [telnet] "launch shell" takes forever *******************************************************************************/ package org.eclipse.rse.internal.services.shells; @@ -49,18 +50,19 @@ public class TerminalShellService extends AbstractShellService { public IHostShell launchShell(String initialWorkingDirectory, String encoding, String[] environment, IProgressMonitor monitor) throws SystemMessageException { - ITerminalShell terminalShell = fTerminalService.launchTerminal(null, - encoding, environment, initialWorkingDirectory, null, monitor); - TerminalServiceHostShell hostShell = new TerminalServiceHostShell( - terminalShell, initialWorkingDirectory, - TerminalServiceHostShell.SHELL_INVOCATION, environment); - return hostShell; + return runCommand(initialWorkingDirectory, TerminalServiceHostShell.SHELL_INVOCATION, encoding, environment, monitor); } - public IHostShell runCommand(String initialWorkingDirectory, - String command, String encoding, String[] environment, - IProgressMonitor monitor) throws SystemMessageException { - ITerminalShell terminalShell = fTerminalService.launchTerminal(null, + public IHostShell runCommand(String initialWorkingDirectory, String command, String encoding, String[] environment, IProgressMonitor monitor) + throws SystemMessageException { + // vt100 is the most common kind of terminal, and default for Telnet + // and SSH: see Commons Net TelnetClient#TelnetClient() and JSch + // ChannelSession#ttype. + // We therefore pick vt100 here, and adapt to it by ignoring control + // sequences in TerminalServiceShellOutputReader line 100. We could + // also request a "dumb" type here, but testing showed that the + // prompt is then not detected correctly. + ITerminalShell terminalShell = fTerminalService.launchTerminal("vt100", //$NON-NLS-1$ encoding, environment, initialWorkingDirectory, null, monitor); TerminalServiceHostShell hostShell = new TerminalServiceHostShell( terminalShell, initialWorkingDirectory, command, environment); @@ -95,7 +97,7 @@ public class TerminalShellService extends AbstractShellService { } return o; } - + public String getName() { return RSEServicesMessages.TerminalShellService_name;