Have you found solution any on how to ssh using expect with threads?
sub thDoWork {
#variables
my $thread_number = $_[0];
my $PassStoreQueue = $_[1];
my $Thread_Die = '';
my $My_Print_Bucket = '';
while ($Thread_Die ne 'KILL_THREAD') {
my $temp_Store_Number_Working_On = $PassStoreQueue->dequeue();
my $name;
my $ip;
my $Device_Exist;
my $TempDeviceName;
my $DNS_Results;
# I need to ssh inside many threads, I can ssh from the main
# thread just fine but not a sub thread.
$ssh = Expect->spawn("ssh -l $username1 $temp_ssh_device " .
"-o UserKnownHostsFile=/dev/null " .
"-o StrictHostKeyChecking=no")
or return "Couldn't spawn ssh session";
# this is unable to login to device.
}
I have read a thread that expect is not working correctly in threads, is that still true?