Commit aaad95b4 authored by Tankypon's avatar Tankypon

Correct bug when Don't Panic exits on Windows

parent 0b63f062
......@@ -801,8 +801,15 @@ class DontPanic:
webbrowser.open("http://localhost:{}".format(self.port))
def stop(self):
import signal
os.kill(os.getpid(), signal.SIGKILL)
if sys.platform == 'win32':
"""Kill for Win32 (https://docs.python.org/2/faq/windows.html#how-do-i-emulate-os-kill-in-windows)"""
import ctypes
kernel32 = ctypes.windll.kernel32
handle = kernel32.OpenProcess(1, 0, os.getpid())
kernel32.TerminateProcess(handle, 0)
else:
import signal
os.kill(os.getpid(), signal.SIGKILL)
def run(self):
openurl = Thread(target=self.open_in_browser)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment