Skip to content

Commit

Permalink
Merge pull request #344 from EvanBldy/main
Browse files Browse the repository at this point in the history
[events][windows] add signal handler on windows platform to properly …
  • Loading branch information
EvanBldy authored Nov 14, 2024
2 parents 28df145 + 9cb1bf2 commit 543d40d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions gazu/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,25 @@
from .exception import AuthFailedException
from .client import default_client, get_event_host
from gazu.client import make_auth_header
from engineio.base_client import signal_handler
import socketio
import os
import inspect
import signal
import socketio

if os.name == "nt":
from win32api import SetConsoleCtrlHandler

def WindowsSignalHandler(event):
if event == 0:
try:
signal_handler(signal.SIGINT, inspect.currentframe())
except:
# SetConsoleCtrlHandler handle cannot raise exceptions
pass

SetConsoleCtrlHandler(WindowsSignalHandler, 1)


class EventsNamespace(socketio.ClientNamespace):
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ install_requires =
python-socketio[client]>=5.11.0,<6; python_version != '2.7'
requests>=2.25.1
Deprecated==1.2.14
pywin32>=308; sys_platform == 'win32' and python_version != '2.7'

[options.packages.find]
# ignore gazutest directory
Expand Down

0 comments on commit 543d40d

Please sign in to comment.