我可以在 R 中捕获信号吗?
Can I trap signals in R?
在 bash 中,我可以捕获 SIGINT
、SIGKILL
、SIGTERM
等。这让我可以根据程序意外停止的方式做不同的事情。
有没有办法在 R 中做到这一点?
扩展一下我的评论,OP 要求我post 作为回答
条件的帮助文件有描述
These functions provide a mechanism for handling unusual conditions, including errors and warnings.
文件中解释了很多处理函数,并附有示例。所以我建议从
开始
help(conditions)
## and
example(conditions)
此外,tools::assertCondition
也值得一看。它链接在 conditions 文档的底部。
在 bash 中,我可以捕获 SIGINT
、SIGKILL
、SIGTERM
等。这让我可以根据程序意外停止的方式做不同的事情。
有没有办法在 R 中做到这一点?
扩展一下我的评论,OP 要求我post 作为回答
条件的帮助文件有描述
These functions provide a mechanism for handling unusual conditions, including errors and warnings.
文件中解释了很多处理函数,并附有示例。所以我建议从
开始help(conditions)
## and
example(conditions)
此外,tools::assertCondition
也值得一看。它链接在 conditions 文档的底部。