scripts/mosh: Add --ssh flag
Let users specify an ssh outside their PATH, or extra flags like -p or -i. Modify the usage message to describe this feature and hint at the semantic difference viz. --client=path\ to\ client vs --ssh="path\ to\ ssh". Closes #53 [keithw@mit.edu -- applied fixes per Anders Kaseorg]
This commit is contained in:
committed by
Keith Winstein
parent
c2a5941f88
commit
86113b5f7a
+10
-3
@@ -33,15 +33,17 @@ my $predict = undef;
|
||||
|
||||
my $port_request = undef;
|
||||
|
||||
my $ssh = 'ssh';
|
||||
|
||||
my $help = undef;
|
||||
my $version = undef;
|
||||
|
||||
my $usage =
|
||||
qq{Usage: $0 [options] [--] [user@]host [command...]
|
||||
--client=PATH mosh client on local machine
|
||||
(default: "mosh-client")
|
||||
(default: mosh-client)
|
||||
--server=PATH mosh server on remote machine
|
||||
(default: "mosh-server")
|
||||
(default: mosh-server)
|
||||
|
||||
--predict=adaptive local echo for slower links [default]
|
||||
-a --predict=always use local echo even on fast links
|
||||
@@ -49,6 +51,10 @@ qq{Usage: $0 [options] [--] [user@]host [command...]
|
||||
|
||||
-p NUM --port=NUM server-side UDP port
|
||||
|
||||
--ssh=COMMAND ssh command to run when setting up session
|
||||
(example: "ssh -p 2222")
|
||||
(default: "ssh")
|
||||
|
||||
--help this message
|
||||
--version version and copyright information
|
||||
|
||||
@@ -79,6 +85,7 @@ GetOptions( 'client=s' => \$client,
|
||||
'a' => sub { $predict = 'always' },
|
||||
'n' => sub { $predict = 'never' },
|
||||
'p=i' => \$port_request,
|
||||
'ssh=s' => \$ssh,
|
||||
'help' => \$help,
|
||||
'version' => \$version,
|
||||
'fake-proxy!' => \my $fake_proxy ) or die $usage;
|
||||
@@ -205,7 +212,7 @@ if ( $pid == 0 ) { # child
|
||||
}
|
||||
|
||||
my $quoted_self = shell_quote( $0 );
|
||||
exec 'ssh', '-S', 'none', '-o', "ProxyCommand=$quoted_self --fake-proxy -- %h %p", '-t', $userhost, '--', "$server " . shell_quote( @server );
|
||||
exec "$ssh " . shell_quote( '-S', 'none', '-o', "ProxyCommand=$quoted_self --fake-proxy -- %h %p", '-t', $userhost, '--', "$server " . shell_quote( @server ) );
|
||||
die "Cannot exec ssh: $!\n";
|
||||
} else { # server
|
||||
my ( $ip, $port, $key );
|
||||
|
||||
Reference in New Issue
Block a user