X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=lib%2FRexec.pm;h=2eecab803b2bb682d2775b27cfa25c0b31629713;hb=bdb1e0c845a6921e22d52fbff3404d5c1dfae520;hp=71fdd224da40d6b0ac488004ee8add2d5d4b4c97;hpb=4accf346e37b757479d5f1537e71996f5d96a061;p=clearscm.git diff --git a/lib/Rexec.pm b/lib/Rexec.pm index 71fdd22..2eecab8 100644 --- a/lib/Rexec.pm +++ b/lib/Rexec.pm @@ -160,16 +160,18 @@ our @EXPORT = qw ( my @lines; -sub _debug ($) { +sub _debug ($) { my ($msg) = @_; - + my $logfile = "/tmp/rexex_debug.log"; - - open my $file, '>>', $logfile or die "Unable to open $logfile for writing - $!"; - + + open my $file, '>>', $logfile or croak "Unable to open $logfile for writing - $!"; + print $file "DEBUG: $msg\n"; - - close $file; + + close $file; + + return; } # _debug sub ssh { @@ -237,7 +239,7 @@ sub ssh { if ($logged_in) { # It's always hard to find the prompt. So let's make a distintive one - $self->{prompt} = '@@@'; + $self->{prompt} = "\n@@@"; $self->{handle} = $remote; # OK this is real tricky. If we call execute with a command of PS1=@@@ @@ -500,6 +502,10 @@ Returns: # Close any prior opened sessions $self->logoff if ($self->{handle}); + # Check to see if this machines is known in DNS. If not then the chance is + # good that we will not be able to log in + return unless gethostbyname $self->{host}; + my $remote; if ($self->{protocol}) { @@ -567,7 +573,7 @@ Returns: } # logoff sub new { - my ($class) = shift; + my ($class, %parms) = @_; =pod @@ -632,8 +638,6 @@ Returns: =cut - my %parms = @_; - my $self = {}; $self->{host} = $parms{host} ? $parms{host} : 'localhost';