Add --no-ssh-pty option.

This eliminates issues with typeahead being echoed by the remote pty
and corrupting remote output from mosh-server to the mosh script, but
cannot be made default because older mosh-servers require a pty.
This commit is contained in:
John Hood
2014-05-17 01:34:14 -04:00
parent 8945efeb82
commit 70d48fbcc0
3 changed files with 15 additions and 3 deletions
+6
View File
@@ -114,6 +114,12 @@ OpenSSH command to remotely execute mosh-server on remote machine (default: "ssh
An alternate ssh port can be specified with, \fIe.g.\fP, \-\-ssh="ssh \-p 2222". An alternate ssh port can be specified with, \fIe.g.\fP, \-\-ssh="ssh \-p 2222".
.TP
.B \-\-ssh-pty\fP
.B \-\-no-ssh-pty\fP
Enable or disable ssh's use of a pty when connecting to a remote host.
The default is enabled.
.TP .TP
.B \-\-predict=\fIWHEN\fP .B \-\-predict=\fIWHEN\fP
Controls use of speculative local echo. WHEN defaults to `adaptive' Controls use of speculative local echo. WHEN defaults to `adaptive'
+9 -1
View File
@@ -72,6 +72,8 @@ my $term_init = 1;
my $localhost = undef; my $localhost = undef;
my $ssh_pty = 1;
my $help = undef; my $help = undef;
my $version = undef; my $version = undef;
@@ -104,6 +106,8 @@ qq{Usage: $0 [options] [--] [user@]host [command...]
(example: "ssh -p 2222") (example: "ssh -p 2222")
(default: "ssh") (default: "ssh")
--no-ssh-pty do not allocate a pseudo tty on ssh connection
--no-init do not send terminal initialization string --no-init do not send terminal initialization string
--local run mosh-server locally without using ssh --local run mosh-server locally without using ssh
@@ -147,6 +151,7 @@ GetOptions( 'client=s' => \$client,
'6' => sub { $family = 'inet6' }, '6' => sub { $family = 'inet6' },
'p=s' => \$port_request, 'p=s' => \$port_request,
'ssh=s' => sub { @ssh = shellwords($_[1]); }, 'ssh=s' => sub { @ssh = shellwords($_[1]); },
'ssh-pty!' => \$ssh_pty,
'init!' => \$term_init, 'init!' => \$term_init,
'local' => \$localhost, 'local' => \$localhost,
'help' => \$help, 'help' => \$help,
@@ -328,7 +333,10 @@ die "$0: fork: $!\n" unless ( defined $pid );
if ( $pid == 0 ) { # child if ( $pid == 0 ) { # child
open(STDERR, ">&STDOUT") or die; open(STDERR, ">&STDOUT") or die;
my @sshopts = ( '-n', '-tt' ); my @sshopts = ( '-n' );
if ($ssh_pty) {
push @sshopts, '-tt';
}
my $ssh_connection = ""; my $ssh_connection = "";
if ( $use_remote_ip eq 'remote' ) { if ( $use_remote_ip eq 'remote' ) {
-2
View File
@@ -388,8 +388,6 @@ static int run_server( const char *desired_ip, const char *desired_port,
if ( ioctl( STDIN_FILENO, TIOCGWINSZ, &window_size ) < 0 || if ( ioctl( STDIN_FILENO, TIOCGWINSZ, &window_size ) < 0 ||
window_size.ws_col == 0 || window_size.ws_col == 0 ||
window_size.ws_row == 0 ) { window_size.ws_row == 0 ) {
fprintf( stderr, "Server started without pseudo-terminal. Opening 80x24 terminal.\n" );
/* Fill in sensible defaults. */ /* Fill in sensible defaults. */
/* They will be overwritten by client on first connection. */ /* They will be overwritten by client on first connection. */
memset( &window_size, 0, sizeof( window_size ) ); memset( &window_size, 0, sizeof( window_size ) );