CC: | "luc.belleville [...] bell.ca" <luc.belleville [...] bell.ca>, "jimmy.armand [...] bell.ca" <jimmy.armand [...] bell.ca>, "marian.romascanu [...] bell.ca" <marian.romascanu [...] bell.ca>, "deborah.fahey [...] bell.ca" <deborah.fahey [...] bell.ca> |
Subject: | SIGCHLD setted to 'IGNORE' by Net::Appliance |
Date: | Wed, 5 Sep 2012 11:09:42 -0400 |
To: | "bug-Net-Appliance-Session [...] rt.cpan.org" <bug-Net-Appliance-Session [...] rt.cpan.org> |
From: | "alain.vicet [...] bell.ca" <alain.vicet [...] bell.ca> |
Hi,
After a Net::applicance connexion, SIGCHLD is setted to IGNORE, see the following example :
use Net::Appliance::Session;
printSigChld();
my $s = Net::Appliance::Session->new({ personality => 'ios', transport => 'SSH', host => 'xxxxxx'});
$s->connect({ username=>"login", password=>"pass" });
$s->close;
printSigChld();
my $res = `ls`;
print("error=$? - $!\n");
sub printSigChld {
if ($SIG{CHLD}) {
print("SIGCHLD=$SIG{CHLD}\n");
} else {
print("SIGCHLD undefined\n");
}
}
Which involve a output error status when invoking the 'ls' system call:
[alain]# ./test-session.pl
SIGCHLD undefined
SIGCHLD=IGNORE
error=-1 - No child processes
A quick fix is possible by deleting SIGCHLD after the Net::Appliance close:
$s->connect({ username=>"login", password=>"pass" });
$s->close;
printSigChld();
delete($SIG{CHLD});
printSigChld();
my $res = `ls`;
print("error=$?\n");
Which output the expected result:
[alain]# ./test-session.pl
SIGCHLD undefined
SIGCHLD=IGNORE
SIGCHLD undefined
error=0
regards