..which works, but I wanted to set it in as small a scope as possible, but can anyone explain why this works:$SIG{TERM} = 'IGNORE';
But this doesn't (actually I'm not clear on why even the first one works...I thought it would only affect signals that the perl process recieves...not the ssh process) :my $sftp = do { local $SIG{TERM} = 'IGNORE'; Net::SFTP::Foreign->new( host => $host, user => $user, password => $pass, autodie => 1, ); }; $sftp->disconnect();
Update: It's pretty clear to me now...the new() forks/execs a new process with the signal mask set to ignore SIGTERM, so when you actually disconnect(), the completely separate process is still operating under the ignore SIGTERM signal mask, and has no knowledge of what perl's current signal mask is.my $sftp = do { #local $SIG{TERM} = 'IGNORE'; Net::SFTP::Foreign->new( host => $host, user => $user, password => $pass, autodie => 1, ); }; do { local $SIG{TERM} = 'IGNORE' $sftp->disconnect(); }
In reply to Net::SFTP::Foreign message on disconnect by runrig
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |