Skip to content

Commit

Permalink
Merge pull request #15 from klementng/dev
Browse files Browse the repository at this point in the history
Fix crash in linux
  • Loading branch information
klementng committed Mar 23, 2024
2 parents 3a6b576 + 6cb8c15 commit 4dcb56c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
11 changes: 5 additions & 6 deletions core.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def start(self):
kw = {
"stdout": subprocess.PIPE,
"stderr": subprocess.PIPE,
"shell": True,
# "shell": True,
}

if platform.system() == "Windows":
Expand All @@ -208,8 +208,9 @@ def start(self):
return True
else:
self.log.critical(
"Unable to start wstunnel. Process return a status code of: %s",
"Unable to start wstunnel. Process return a status code of: %s. %s",
self.process.returncode,
self.process.stderr.read()
)
return False

Expand Down Expand Up @@ -421,9 +422,7 @@ def remove_orphan_iface(self):
def start(self):
self.log.info(f"Starting {self.iface_name}...")

self.remove_orphan_iface()

if platform.system().lower() == "windows":
if platform.system() == "Windows":
action = "/installtunnelservice"
else:
action = "up"
Expand All @@ -432,7 +431,7 @@ def start(self):

if status.returncode == 0:
self.log.info("Started wireguard!")
return True
return self.is_running
else:
self.log.critical(
f"Unable to start wireguard. Program return status code of: {status.returncode}"
Expand Down
10 changes: 7 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,18 @@ def main(
sys.exit(1)

if not wireguard.is_running:
if wireguard.start():
if wireguard in active_processes:
wireguard.restart()
elif wireguard.start():
active_processes.append(wireguard)

if not wstunnel.is_running:
if wstunnel.start():
if wstunnel in active_processes:
wstunnel.restart()
elif wstunnel.start():
active_processes.append(wstunnel)

time.sleep(3)
time.sleep(5)

if isinstance(root_win, CoreGUI):
tk.Button(
Expand Down

0 comments on commit 4dcb56c

Please sign in to comment.