Skip to content

Commit

Permalink
using sigint on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mdipierro committed Nov 17, 2024
1 parent 6f9577b commit dce2004
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion py4web/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,12 @@ def start_server(kwargs):

# Catch interrupts like Ctrl-C if needed
def kill_all(sig, _):
os.kill(os.getpid(), signal.SIGKILL)
if hasattr(signal, "SIGKILL"):
# on linux and mac
os.kill(os.getpid(), signal.SIGKILL)
else:
# on windows
os.kill(os.getpid(), signal.SIGINT)

signal.signal(signal.SIGINT, kill_all)

Expand Down

0 comments on commit dce2004

Please sign in to comment.