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

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -