fix: replace os to subprocess

This commit is contained in:
dettlaff 2023-08-07 17:38:44 +04:00
parent aadf0cb1a3
commit 446220a9c5
1 changed files with 1 additions and 2 deletions

View File

@ -1,5 +1,4 @@
import re
import os
import subprocess
from selfprivacy_api.utils.huey import huey
@ -13,7 +12,7 @@ CLEAR_COMPLETED = "Cleaning completed."
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(
"utf-8"