簡単なテスト機能の使用
timefoo<-function(x,trans=TRUE){
setTimeLimit(elapse=4, transient=trans)
warning('starting...')
Sys.sleep(x)
warning('woke up')
return(x)
}
を呼び出すと、関数は適切に終了しますが、次のようになりますtimefoo(5)
。
timefoo(3)
[1] 3
Warning messages:
1: In timefoo(3) : starting...
2: In timefoo(3) : woke up
Error: reached elapsed time limit
誰かが正確に何が起こっているのか説明できますか? 終了して終了しsetTimeLimit
た後も実行し続けるかのようです。timefoo
コンソールコマンドのタイムアウトを設定し、コマンドごとに(さらに4秒)エラーメッセージを表示するため、設定transient=FALSE
はさらに悪化します。
編集: Gavin の質問への回答として、2 つの通話のシーケンスを次に示します。
Rgames> timefoo(5)
Error in Sys.sleep(x) : reached elapsed time limit
In addition: Warning message:
In timefoo(5) : starting...
Rgames> timefoo(3)
[1] 3
Warning messages:
1: In timefoo(3) : starting...
2: In timefoo(3) : woke up
Error: reached elapsed time limit
timefoo(3)
コマンド間で手動で 10 秒待機したので、最終的なエラー メッセージが呼び出しによるものであることは間違いありません。この動作を引き起こしている R_ENVIRON 変数がありますか? これまでのところ、これは Windows7、R64 でしかテストしていません。