[R-SIG-Mac] Sys.sleep() in R.app can't be interrupted
Duncan Murdoch
murdoch@dunc@n @end|ng |rom gm@||@com
Wed Apr 1 21:32:59 CEST 2026
This might be a well known issue, but I couldn't spot it in the FAQ or
bug list or mailing list archives.
If you execute Sys.sleep(60) in R.app, the command can't be interrupted
by ESC or Cmd-C until it is done. R.app becomes completely unresponsive.
The number 60 isn't important, as far as I can tell this is true for any
sleep time.
A simple workaround is to limit the duration of Sys.sleep() calls, e.g.
using a function like this:
Sleep <- function(duration) {
seconds <- floor(duration)
for (i in seq_len(seconds))
Sys.sleep(1)
Sys.sleep(duration - seconds)
}
R.app handles interrupts every time Sys.sleep returns, so this means the
biggest delay is 1 second.
In case this isn't universal, here's my session info:
```
R version 4.5.3 (2026-03-11)
Platform: aarch64-apple-darwin20
Running under: macOS Sequoia 15.7.4
Matrix products: default
BLAS:
/Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRblas.0.dylib
LAPACK:
/Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib;
LAPACK version 3.12.1
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/Toronto
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.5.3
```
Duncan Murdoch
More information about the R-SIG-Mac
mailing list