X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=test%2Ftestrexec.pl;fp=test%2Ftestrexec.pl;h=07ab9959e412946db75f23a9aa60583d016659a8;hb=85a506f0983544ac5e06634fb6329a5fd9db4d01;hp=5f35bc31f9ea0aac61837b26ec140b1aad0c16a3;hpb=b51c35a31f4a36c2561994293571e2df68afaf51;p=clearscm.git diff --git a/test/testrexec.pl b/test/testrexec.pl index 5f35bc3..07ab995 100755 --- a/test/testrexec.pl +++ b/test/testrexec.pl @@ -14,6 +14,16 @@ my $hostname = $ENV{HOST} || 'localhost'; my $username = $ENV{USERNAME}; my $password = $ENV{PASSWORD}; +my $command = $ENV{COMMAND}; + +if (@ARGV) { + $command = join ' ', @ARGV; +} else { + $command = 'ls /tmp' unless $command; +} # if + +print "Attempting to connect to $username\@$hostname to execute \"$command\"\n"; + my $remote = Rexec->new ( host => $hostname, username => $username, @@ -24,19 +34,18 @@ my $remote = Rexec->new ( if ($remote) { print "Connected to $username\@$hostname using " . $remote->{protocol} . " protocol\n"; - - $cmd = "/bin/ls /nonexistent"; - @output = $remote->execute ($cmd); + print "Executing command \"$command\" on $hostname as $username\n"; + @output = $remote->execute ($command); $status = $remote->status; - print "$cmd status: $status\n"; + print "\"$command\" status: $status\n"; - $remote->print_lines; - - print "$_\n" foreach ($remote->execute ('cat /etc/passwd')); + if (@output == 0) { + print "No lines of output received!\n"; + } else { + print "$_\n" foreach (@output); + } # if } else { print "Unable to connect to $username@$hostname\n"; -} # if - - +} # if \ No newline at end of file