Subject: | Test::SSH server dies after a fork |
# Test::SSH kills the test ssh server when a child process exits, also
# terminating the server for the parent process. Here is a small script that
# demonstrates the issue on a system where Net::OpenSSH is available:
#
# -->8-->8-->8--
use Test::More;
use Test::SSH;
use Net::OpenSSH;
my $server = Test::SSH->new;
diag "------ Test::SSH configured -----------";
my %opts = (user => $server->user, # may need to tweak this
host => $server->host,
port => $server->port,
# password => $server->password,
key_path => $server->key_path);
ok(Net::OpenSSH->new(%opts)->capture("ls"), 'got ssh output');
ok(Net::OpenSSH->new(%opts)->capture("ls"), 'got ssh output again');
fork or exit;
wait;
ok(Net::OpenSSH->new(%opts)->capture("ls"), 'got ssh output post-fork')
or diag "Can't use Test::SSH after a child process exits";
done_testing();