use anyhow::Result;
use std::path::PathBuf;
#[allow(clippy::too_many_arguments)]
pub async fn run(
allow: Vec<PathBuf>,
no_default_allows: bool,
experimental_sandbox: bool,
strace: bool,
session: Option<String>,
system: bool,
postgres_url: Option<String>,
command: PathBuf,
args: Vec<String>,
) -> Result<()> {
if experimental_sandbox {
if !allow.is_empty() || no_default_allows {
eprintln!("Warning: --allow and --no-default-allows are not supported with --experimental-sandbox, ignoring");
}
if session.is_some() {
eprintln!("Warning: --session is not supported with --experimental-sandbox, ignoring");
}
crate::sandbox::linux_ptrace::run_cmd(strace, command, args).await;
} else {
if strace {
eprintln!("Warning: --strace is only supported with --experimental-sandbox, ignoring");
}
crate::sandbox::linux::run_cmd(
allow,
no_default_allows,
session,
system,
postgres_url,
command,
args,
)
.await?;
}
Ok(())
}