use std::env;
const HELPER_ENV: &str = "MERRY_SANDBOX_HELPER";
const SETUP_EXIT_CODE: i32 = 126;
#[must_use]
pub fn sandbox_helper_requested() -> bool {
env::var_os(HELPER_ENV).is_some()
}
pub fn sandbox_helper_main() -> ! {
eprintln!(
"merry-sandbox: workspace sandbox is unavailable on {}",
std::env::consts::OS
);
std::process::exit(SETUP_EXIT_CODE);
}
pub fn probe_workspace_sandbox() -> Result<(), String> {
Err(format!(
"workspace sandbox is unavailable on {}",
std::env::consts::OS
))
}
pub(crate) fn setup_failure(stderr: &[u8]) -> Option<String> {
let text = String::from_utf8_lossy(stderr);
text.lines()
.find(|line| line.starts_with("merry-sandbox:"))
.map(|line| line.trim().to_owned())
}