Spawn bwrap and mirror its exit status instead of exec'ing into it
This commit is contained in:
+6
-3
@@ -11,12 +11,15 @@ mod sandbox;
|
||||
mod sandbox_info;
|
||||
mod seccomp;
|
||||
mod session_key;
|
||||
mod signals;
|
||||
|
||||
pub use errors::SandboxError;
|
||||
pub use signals::exit_with_status;
|
||||
|
||||
use std::ffi::OsString;
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
use std::process::ExitStatus;
|
||||
|
||||
use crate::sandbox::Bwrap;
|
||||
|
||||
@@ -90,15 +93,15 @@ fn resolve_run_user_from_proc() -> Option<String> {
|
||||
None
|
||||
}
|
||||
|
||||
pub fn run(config: SandboxConfig) -> Result<(), SandboxError> {
|
||||
pub fn run(config: SandboxConfig) -> Result<ExitStatus, SandboxError> {
|
||||
preflight::check(&config)?;
|
||||
|
||||
let bwrap = Bwrap::build(&config)?;
|
||||
|
||||
if config.dry_run {
|
||||
println!("{}", bwrap.shell_quoted());
|
||||
return Ok(());
|
||||
return Ok(ExitStatus::default());
|
||||
}
|
||||
|
||||
Err(SandboxError::Io(bwrap.exec()))
|
||||
Ok(bwrap.run()?)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user