cmd/
cmd.rs

1fn shell() -> String {
2    #[cfg(windows)]
3    {
4        "cmd".to_string()
5    }
6    #[cfg(unix)]
7    {
8        std::env::var("SHELL").unwrap_or_else(|_| "bash".into())
9    }
10}
11
12fn main() {
13    println!("Starting a root shell:");
14    println!(
15        "Status: {}",
16        run_as::Command::new(shell())
17            .wait_to_complete(true)
18            .status()
19            .expect("failed to execute")
20    );
21}