ssl_decrypt.py now with output and check_call replace with subprocess.run

This commit is contained in:
2025-05-11 18:24:57 +02:00
parent a903666a26
commit 6604650adf
6 changed files with 68 additions and 39 deletions

View File

@ -122,18 +122,21 @@ class AppConfig:
if not cls.SYSTEMD_USER_FOLDER.exists():
cls.SYSTEMD_USER_FOLDER.mkdir(parents=True, exist_ok=True)
for line in SYSTEMD_FILE:
cls.AUTOSTART_SERVICE.write_text(line)
from subprocess import CompletedProcess
process = subprocess.run(
if not cls.AUTOSTART_SERVICE.is_file():
content = "\n".join([line for line in SYSTEMD_FILE])
cls.AUTOSTART_SERVICE.write_text(content)
process: CompletedProcess[str] = subprocess.run(
["systemctl", "--user", "enable", "wg_start.service"],
stdout=subprocess.PIPE,
capture_output=True,
text=True,
check=True,
check=False,
)
print(process.stdout)
if process.returncode == 0:
print("File for autostart created successfully")
print(process.stdout)
else:
print(f"Error with the following code... {process.returncode}")