withTimeout: Execute an expression with a timeout

View source: R/server.R

withTimeoutR Documentation

Execute an expression with a timeout

Description

Execute an expression with a timeout

Usage

withTimeout(expr, timeout = 2)

Arguments

expr

The expression to execute

timeout

The timeout in seconds. Default is 2.

Value

The result of the expression

Examples

withTimeout(cat("This works\n"), timeout = 0.2)
try(withTimeout({Sys.sleep(0.2); cat("This will fail\n")}, timeout = 0.1))

FastRet documentation built on June 25, 2024, 5:07 p.m.