ssl_decrypt.py now with output and check_call replace with subprocess.run
This commit is contained in:
@ -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}")
|
||||
|
Reference in New Issue
Block a user