From bce859434884b3d147b75eb1ab085b937353d436 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 17 May 2021 19:18:42 +0100 Subject: [PATCH] pakfire.cgi: Use new system methods Signed-off-by: Michael Tremer --- html/cgi-bin/pakfire.cgi | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi index faaeb4222c..631587ce27 100644 --- a/html/cgi-bin/pakfire.cgi +++ b/html/cgi-bin/pakfire.cgi @@ -57,12 +57,10 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, "$Lang::tr{'pakfire install package'}.$cgiparams{'INSPAKS'}.$Lang::tr{'pakfire possible dependency'}
@@ -97,12 +95,10 @@ END
 
 	$cgiparams{'DELPAKS'} =~ s/\|/\ /g;
 	if ("$cgiparams{'FORCE'}" eq "on") {
-		my $command = "/usr/local/bin/pakfire remove --non-interactive --no-colors $cgiparams{'DELPAKS'} &>/dev/null &";
-		system("$command");
-		system("/bin/sleep 1");
+		&General::system_background("/usr/local/bin/pakfire", "remove", "--non-interactive", "--no-colors", $cgiparams{'DELPAKS'});
 	} else {
 		&Header::openbox("100%", "center", $Lang::tr{'request'});
-		my @output = `/usr/local/bin/pakfire resolvedeps --no-colors $cgiparams{'DELPAKS'}`;
+		my @output = &General::system_output("/usr/local/bin/pakfire", "resolvedeps", "--no-colors", $cgiparams{'DELPAKS'});
 		print <$Lang::tr{'pakfire uninstall package'}.$cgiparams{'DELPAKS'}.$Lang::tr{'pakfire possible dependency'}
 		
@@ -135,13 +131,9 @@ END
 	}
 
 } elsif (($cgiparams{'ACTION'} eq 'update') && (! -e $Pakfire::lockfile)) {
-
-	system("/usr/local/bin/pakfire update --force --no-colors &>/dev/null &");
-	system("/bin/sleep 1");
+	&General::system_background("/usr/local/bin/pakfire", "update", "--force", "--no-colors");
 } elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e $Pakfire::lockfile)) {
-	my $command = "/usr/local/bin/pakfire upgrade -y --no-colors &>/dev/null &";
-	system("$command");
-	system("/bin/sleep 1");
+	&General::system_background("/usr/local/bin/pakfire", "upgrade", "-y", "--no-colors");
 } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") {
 	$pakfiresettings{"TREE"} = $cgiparams{"TREE"};
 
@@ -154,7 +146,7 @@ END
 		&General::writehash("${General::swroot}/pakfire/settings", \%pakfiresettings);
 
 		# Update lists
-		system("/usr/local/bin/pakfire update --force --no-colors &>/dev/null &");
+		&General::system_background("/usr/local/bin/pakfire", "update", "--force", "--no-colors");
 	}
 }
 
-- 
2.39.5