Override die in Perl and still return correct exit code on Windows -
on windows, want execute when script dies. below block didn't help; think it's because windows don't support signals.
$sig{__die__} = sub { qx(taskkill /f /im telnet.exe); core::die @_; }
then tried this:
end { qx(taskkill /f /im telnet.exe); exit $exit_code; }
it performed taskkill
, exited exit code 0. need propagate exit_code
further processing based on it.
end
blocks can set $?
control exit value.
end { qx(taskkill /f /im telnet.exe); $? = $exit_code; }
Comments
Post a Comment