1use privesc::PrivilegedCommand;
2
3fn main() {
4 let output = PrivilegedCommand::new("cat")
5 .arg("/etc/shadow")
6 .gui(true)
7 .prompt("Administrator privileges required to read the test file")
8 .run()
9 .unwrap();
10
11 println!("Exit status: {}", output.status);
12
13 match output.stdout_str() {
14 Some(stdout) => println!("Out: {stdout}"),
15 None => println!("Out: <not available on this platform>"),
16 }
17
18 match output.stderr_str() {
19 Some(stderr) => println!("Err: {stderr}"),
20 None => println!("Err: <not available on this platform>"),
21 }
22}