Learn R Programming

NoSleepR (version 0.2.0)

with_nosleep: Execute an expression while preventing the system from sleeping

Description

Helper that automatically brackets an expression with nosleep_on() and nosleep_off().

Usage

with_nosleep(expr, keep_display = FALSE)

Value

The result of evaluating expr.

Arguments

expr

Expression to execute while nosleep is on.

keep_display

logical. If TRUE, also prevent the display from sleeping.

Examples

Run this code
if (FALSE) {
with_nosleep({
  message("Downloading a large file…")
  download_large_file()
})
}

Run the code above in your browser using DataLab