fix: edge case with only sudo command

This commit is contained in:
iff 2024-12-05 20:03:12 +01:00
parent c99c736ad5
commit 94d011cdd1
2 changed files with 9 additions and 3 deletions

View file

@ -76,7 +76,7 @@ pub fn expand_alias(shell: &str, full_command: &str) -> String {
}
let split_command = full_command.split_whitespace().collect::<Vec<&str>>();
let (command, pure_command) = if PRIVILEGE_LIST.contains(&split_command[0]) {
let (command, pure_command) = if PRIVILEGE_LIST.contains(&split_command[0]) && split_command.len() > 1 {
(split_command[1], Some(split_command[1..].join(" ")))
} else {
(split_command[0], None)