Skip to content

Commit

Permalink
[mosh] Perform command line initialisation as early as possible
Browse files Browse the repository at this point in the history
mobile-shell#431

Move command line initialisation before considering any of the command line
options to simplify subsequent configuration file operations.

Signed-off-by: Earl Chew <[email protected]>
  • Loading branch information
earlchew committed Apr 7, 2018
1 parent 162d0a2 commit fca128e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions scripts/mosh.pl
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,14 @@ sub predict_check {
exit;
}

if ( scalar @ARGV < 1 ) {
die $usage;
}

my @bind_arguments;
my $userhost = shift;
my @command = @ARGV;

if ( defined $predict ) {
predict_check( $predict, 0 );
} elsif ( defined $ENV{ 'MOSH_PREDICTION_DISPLAY' } ) {
Expand Down Expand Up @@ -688,16 +696,7 @@ sub predict_check {

delete $ENV{ 'MOSH_PREDICTION_DISPLAY' };

my $userhost;
my @command;
my @bind_arguments;

{
if ( scalar @ARGV < 1 ) {
die $usage;
}
$userhost = shift;
@command = @ARGV;
if ( not defined $bind_ip or $bind_ip =~ m{^ssh$}i ) {
if ( not defined $localhost ) {
push @bind_arguments, '-s';
Expand Down

0 comments on commit fca128e

Please sign in to comment.