diff --git a/R/stop_early.R b/R/stop_early.R index 876b024..563a1bd 100644 --- a/R/stop_early.R +++ b/R/stop_early.R @@ -6,7 +6,7 @@ #' @export #' @examples #' testfun <- function(...) {stop_early(); message("Completed function."); 1} -#' testfun() +#' if(interactive()) testfun() stop_early <- function(msg="Exiting function early.") { opt <- options(show.error.messages = FALSE) on.exit(options(opt)) diff --git a/man/stop_early.Rd b/man/stop_early.Rd index d58b91d..3928bbe 100644 --- a/man/stop_early.Rd +++ b/man/stop_early.Rd @@ -16,6 +16,6 @@ Null Stop a function early without an error. } \examples{ -testfun <- function(...) {stop_early(); message("Completed function.")} -testfun() +testfun <- function(...) {stop_early(); message("Completed function."); 1} +if(interactive()) testfun() }