replace usage of Command with ShellCommand

i18n
mrshmllow 2 years ago committed by Michal
parent 09195b104c
commit 690b5d5a18

@ -1,5 +1,3 @@
use tokio::process::Command;
use crate::crash; use crate::crash;
use crate::internal::commands::ShellCommand; use crate::internal::commands::ShellCommand;
@ -109,15 +107,16 @@ pub async fn clean(options: Options) {
tracing::debug!("Clearing using `paccache -r`"); tracing::debug!("Clearing using `paccache -r`");
// Clear pacman's cache (keeping latest 3 versions of installed packages) // Clear pacman's cache (keeping latest 3 versions of installed packages)
Command::new(config::read().bin.sudo.unwrap_or_default()) ShellCommand::sudo()
.arg("paccache") .arg("paccache")
.args(paccache_args) .args(paccache_args)
.spawn() .elevated()
.spawn(true)
.unwrap_or_else(|e| { .unwrap_or_else(|e| {
crash!( crash!(
AppExitCode::PacmanError, AppExitCode::PacmanError,
"Couldn't clear cache using `paccache -r`, {}", "Couldn't clear cache using `paccache -r`, {}",
e, e
) )
}) })
.wait() .wait()

Loading…
Cancel
Save