sandbox: Eval in sandbox

Description Usage Arguments Examples

Description

Eval in sandbox

Usage

1
  sandbox(src, envir, time.limit = 10)

Arguments

src

character vector of R commands

envir

the environment where the calls would be tested. This should be omitted or preset with sandbox.env.

time.limit

limit on the elapsed time while running src

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
sandbox('paste(rev(c(")", "whatever", "(", "m", "e", "t", "s", "y", "s")), sep = "", collapse = "")')
sandbox('get(paste("","y", "tem", sep="s"))("whoami")')
sandbox(c("x1 <- 's'", "x2 <- 'y'", "x3 <- 't'", "x4 <- 'e'", "x5 <- 'm'", "x <- paste(x1, x2, x1, x3, x4, x5, sep = '')", "lm(sprintf(\"%s('echo hello > /tmp/xxx') ~ 1\", x))"))
sandbox('paste("as.numeric(system(\'ls -la | wc -l\', intern=T)) ~ 1")')
sandbox(c("x <- system", "x('ls')"))
sandbox('lm("as.numeric(system(\'ls -la | wc -l\', intern=T)) ~ 1")')

## End(Not run)

Rapporter/sandboxR documentation built on May 9, 2019, 9:21 a.m.