Have rootshell print errors and exit 1 if exec fails

Previously was ignoring the possible error retuned by exec, this commit
has rootshell print the error if exec returns and have the process exit
with a code of 1 instead of 0.
This commit is contained in:
Sashanoraa
2025-03-23 13:40:07 -04:00
committed by Will Greenberg
parent 88f81d86fa
commit 1f4786db19
+4 -1
View File
@@ -25,9 +25,12 @@ fn main() {
// discard argv[0]
let _ = args.next();
Command::new("/bin/bash")
// This call will only return if there is an error
let error = Command::new("/bin/bash")
.args(args)
.uid(0)
.gid(0)
.exec();
eprintln!("Error running command: {error}");
std::process::exit(1);
}