Don't use sudo when already root for file removal
This commit is contained in:
@@ -52,7 +52,7 @@ pub fn rm(todelete_ string) ! {
|
||||
if os.exists(item) {
|
||||
console.print_debug(' - rm: ${item}')
|
||||
if os.is_dir(item) {
|
||||
if core.sudo_path_ok(item)! {
|
||||
if core.sudo_path_ok(item)! || whoami()! == 'root' {
|
||||
// console.print_debug("rm deletedir: ${item}")
|
||||
os.rmdir_all(item)!
|
||||
} else {
|
||||
@@ -64,7 +64,7 @@ pub fn rm(todelete_ string) ! {
|
||||
}
|
||||
} else {
|
||||
// console.print_debug("rm delete file: ${item}")
|
||||
if core.sudo_path_ok(item)! {
|
||||
if core.sudo_path_ok(item)! || whoami()! == 'root' {
|
||||
os.rm(item)!
|
||||
} else {
|
||||
if core.interactive()! {
|
||||
|
||||
Reference in New Issue
Block a user