fix: replace os to subprocess

This commit is contained in:
dettlaff 2023-08-07 17:38:44 +04:00
parent aadf0cb1a3
commit 446220a9c5

View file

@ -1,5 +1,4 @@
import re import re
import os
import subprocess import subprocess
from selfprivacy_api.utils.huey import huey from selfprivacy_api.utils.huey import huey
@ -13,7 +12,7 @@ CLEAR_COMPLETED = "Cleaning completed."
def run_nix_store_print_dead(): def run_nix_store_print_dead():
os.system("nix-env -p /nix/var/nix/profiles/system --delete-generations old") subprocess.run(["nix-env", "-p", "/nix/var/nix/profiles/system", "--delete-generations old"], check=False)
return subprocess.check_output(["nix-store", "--gc", "--print-dead"]).decode( return subprocess.check_output(["nix-store", "--gc", "--print-dead"]).decode(
"utf-8" "utf-8"