% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sandbox.R
\name{run_in_sandbox}
\alias{run_in_sandbox}
\title{Run Code in a Sandbox Environment}
\usage{
run_in_sandbox(
  script_path,
  sandbox = NULL,
  suppress_messages = TRUE,
  suppress_warnings = TRUE,
  capture_output = TRUE
)
}
\arguments{
\item{script_path}{Path to the R script to execute.}

\item{sandbox}{Optional. A sandbox object created by \code{setup_sandbox()}.
If NULL (default), uses the most recently created sandbox.}

\item{suppress_messages}{Logical. Whether to suppress messages (default: TRUE).}

\item{suppress_warnings}{Logical. Whether to suppress warnings (default: TRUE).}

\item{capture_output}{Logical. Whether to capture output (default: TRUE).}
}
\value{
Invisible TRUE on successful execution.
}
\description{
Executes an R script within a sandbox directory, suppressing messages,
warnings, and graphical output. This is useful for testing empirical
analysis scripts without polluting the console or creating unwanted plots.
}
\examples{
with_example({
  sandbox <- setup_sandbox()
  on.exit(cleanup_sandbox(sandbox), add = TRUE)
  run_in_sandbox("analysis.R", sandbox)
})
}
