Skip to content

Commit

Permalink
added null device (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep committed May 19, 2016
1 parent 52d4f4f commit 24e6833
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions R/environment.r
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,13 @@ init_cran_repo <- function() {
init_session <- function() {
init_cran_repo()
}


init_null_device <- function() {
null_file <- switch(.Platform$OS.type, windows = 'NUL', unix = '/dev/null')
null_device <- function(filename = null_file, ...) png(filename, ...)

if (identical(getOption('device'), pdf)) {
options(device = null_device)
}
}
1 change: 1 addition & 0 deletions R/execution.r
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ initialize = function(...) {
# in the current session
init_shadowenv()
init_session()
init_null_device()

callSuper(...)
},
Expand Down

0 comments on commit 24e6833

Please sign in to comment.