diff --git a/xCAT-server/lib/perl/xCAT/SSHInteract.pm b/xCAT-server/lib/perl/xCAT/SSHInteract.pm index ea7b7d9f9..717dba38b 100644 --- a/xCAT-server/lib/perl/xCAT/SSHInteract.pm +++ b/xCAT-server/lib/perl/xCAT/SSHInteract.pm @@ -63,11 +63,15 @@ sub new { #$self->waitfor("-match" => '/password:/i', -errmode => "return") or die "Unable to reach host ",$self->lastline; $self->print($password); my $nextline = $self->getline(); - if ($nextline eq "\n") { + chomp($nextline); + while ($nextline =~ /^\s*$/) { $nextline = $self->get(); + chomp($nextline); } if ($nextline =~ /^password:/ or $nextline =~ /Permission denied, please try again/) { die "Incorrect Password"; + } elsif ($nextline =~ /$promptex/) { + *$self->{_xcatsshinteract}->{_atprompt}=1; } } elsif ($match =~ /$promptex/) { *$self->{_xcatsshinteract}->{_atprompt}=1;