Your system command error checking is wrong; it should be something like:
Also, Perl will automatically add /bin/sh -c if it's necessary, so you don't have to do that.system("...") == 0 or die "...";
But I don't think that's your problem.
I also don't think it's a good idea to use $SIG{CHLD} = 'IGNORE'; and wait() together.
I don't think that's the problem, either.
Your sub declarations have parentheses after them, which creates a prototype. This prototype looks incorrect, and Pel issues a warning under -w.
And I don't think that's your problem either.
The problem I think you're having is that signal handlers are cleared when you use exec, and if you use system then $$ is the PID of the Perl process waiting for system to finish, not SSH. If you use exec, your HUP signal handler is cleared when ssh starts. If you use system, you kill ABRT Perl, doing nothing to the ssh process.
If you want to send an ABRT signal to ssh (and I think that's not the signal you want, since it usually causes a coredump), I think you should use exec in setupProcess, and send an ABRT signal in shutdown.
In reply to Re: Signals and subprocesses using fork, and system or exec.
by sgifford
in thread Signals and subprocesses using fork, and system or exec.
by exussum0
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |