mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-06-14 00:23:34 -07:00
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:
committed by
Will Greenberg
parent
88f81d86fa
commit
1f4786db19
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user