mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2026-02-02 15:45:11 +01:00
improv: check doas first
This commit is contained in:
parent
ad0eaa17fc
commit
982149802a
2 changed files with 2 additions and 2 deletions
|
|
@ -92,7 +92,7 @@ pub fn confirm_correction(shell: &str, command: &str, last_command: &str) {
|
||||||
println!("Press enter to execute the corrected command. Or press Ctrl+C to exit.");
|
println!("Press enter to execute the corrected command. Or press Ctrl+C to exit.");
|
||||||
std::io::stdin().read_line(&mut String::new()).unwrap();
|
std::io::stdin().read_line(&mut String::new()).unwrap();
|
||||||
|
|
||||||
let privilege = Vec::from(["sudo", "doas"]);
|
let privilege = Vec::from(["doas", "sudo"]);
|
||||||
|
|
||||||
for p in privilege {
|
for p in privilege {
|
||||||
if command.starts_with(p){
|
if command.starts_with(p){
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ fn shell_default_history_file(shell: &str) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_privilege() -> Option<String> {
|
pub fn get_privilege() -> Option<String> {
|
||||||
let list = vec!["sudo", "doas"];
|
let list = vec!["doas", "sudo"];
|
||||||
for command in list {
|
for command in list {
|
||||||
if std::process::Command::new(command).output().is_ok() {
|
if std::process::Command::new(command).output().is_ok() {
|
||||||
return Some(command.to_string());
|
return Some(command.to_string());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue