Update dashboard.py

This commit is contained in:
Donald Zou 2024-11-23 17:51:48 +08:00
parent 597528e9b7
commit 71ee784003

View File

@ -973,14 +973,13 @@ class WireguardConfiguration:
self.getStatus() self.getStatus()
if self.Status: if self.Status:
try: try:
check = subprocess.check_output(f"wg-quick down {self.Name}", check = subprocess.call(f"wg-quick down {self.Name}",
shell=True, stderr=subprocess.STDOUT) shell=True, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as exc: except subprocess.CalledProcessError as exc:
return False, str(exc.output.strip().decode("utf-8")) return False, str(exc.output.strip().decode("utf-8"))
else: else:
try: try:
check = subprocess.check_output(f"wg-quick up {self.Name}", check = subprocess.call(f"wg-quick up {self.Name}", shell=True, stderr=subprocess.STDOUT)
shell=True, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as exc: except subprocess.CalledProcessError as exc:
return False, str(exc.output.strip().decode("utf-8")) return False, str(exc.output.strip().decode("utf-8"))
self.getStatus() self.getStatus()