Subject: | thread friendly |
Spawning a new expect object in a thread does not work. The object
spawns without errors, but then no expect data is recieved from the
spawned session. I found this error using perl v5.8.8 built for
i686-linux-thread-multi, Expect v1.20, and IO::Tty v1.07. The attached
script should return a ping response before the main thread dies,
however I receive "A thread exited while 2 threads were running."
Subject: | thr_expect.pl |
use Expect;
use threads;
threads->new( \&thr );
for (my $i=0;$i<7;$i++) { print "Parrent: waiting\n"; sleep 2 }
sub thr
{
my $exp = Expect->spawn("ping -c 4 172.18.40.40") || die "couldn't spawn";
while (1) { print $exp->expect(1, "icmp"); }
}