use std::process::{Command, ExitCode};
fn main() -> ExitCode {
let mut command = Command::new(if cfg!(windows) { "npx.cmd" } else { "npx" });
command
.arg("--yes")
.arg("cloudmux@latest")
.args(std::env::args_os().skip(1));
match command.status() {
Ok(status) => ExitCode::from(status.code().unwrap_or(1) as u8),
Err(error) if error.kind() == std::io::ErrorKind::NotFound => {
eprintln!("cloudmux requires Node.js 20 or newer: https://nodejs.org");
ExitCode::FAILURE
}
Err(error) => {
eprintln!("failed to launch cloudmux: {error}");
ExitCode::FAILURE
}
}
}