我可以在R中捕获信号吗? [英] Can I trap signals in R?
问题描述
在bash中,我可以捕获 SIGINT
, SIGKILL
, SIGTERM
等等。这可以让我根据程序意外停止来做不同的事情。
In bash I can trap SIGINT
, SIGKILL
, SIGTERM
, and so on. That allows me to do different things depending how the program was unexpectedly stopped.
有没有办法在R中执行此操作?
Is there a way to do this in R?
推荐答案
扩展了我的评论,OP要求我作为答案发布
Expanding a bit on my comment which OP asked me to post as an answer
条件的帮助文件有描述
这些功能提供了一个处理机制不寻常的条件,包括错误和警告。
These functions provide a mechanism for handling unusual conditions, including errors and warnings.
有很多处理函数在文件中解释,并附有示例。所以我建议从
There are many handling functions explained in the file, with examples. So I suggest starting with
help(conditions)
## and
example(conditions)
另外, tools :: assertCondition
可能值得看也是它被链接在条件文档的底部。
Additionally, tools::assertCondition
might be worth a look too. It is linked at the bottom of the conditions documentation.
这篇关于我可以在R中捕获信号吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!