是否有可能在 END 块内知道程序是否死亡?在 Perl 中我会这样做
END {
if ( $? == 255 ) {
# ...
}
}
Run Code Online (Sandbox Code Playgroud)
好问题!
据我所知,没有一个。这就是为什么我创建了一个Pull Request来使以下事情成为可能:
END {
unless $*DIED-NATURALLY {
# do special cleanup actions
}
}
Run Code Online (Sandbox Code Playgroud)