mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
don't add signal handler on Windows
This commit is contained in:
@@ -14,6 +14,7 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
import platform
|
||||
import selectors
|
||||
import signal
|
||||
import sys
|
||||
@@ -28,6 +29,8 @@ from ..driver import Driver
|
||||
from ..geometry import Size
|
||||
from ._byte_stream import ByteStream
|
||||
|
||||
WINDOWS = platform.system() == "Windows"
|
||||
|
||||
|
||||
class WebDriver(Driver):
|
||||
"""A headless driver that may be run remotely."""
|
||||
@@ -95,8 +98,9 @@ class WebDriver(Driver):
|
||||
self._app._post_message(messages.ExitApp()), loop=loop
|
||||
)
|
||||
|
||||
for _signal in (signal.SIGINT, signal.SIGTERM):
|
||||
loop.add_signal_handler(_signal, do_exit)
|
||||
if not WINDOWS:
|
||||
for _signal in (signal.SIGINT, signal.SIGTERM):
|
||||
loop.add_signal_handler(_signal, do_exit)
|
||||
|
||||
self._write(b"__GANGLION__\n")
|
||||
|
||||
@@ -185,3 +189,7 @@ class WebDriver(Driver):
|
||||
self._app._post_message(event),
|
||||
loop=self._loop,
|
||||
)
|
||||
elif packet_type == "quit":
|
||||
asyncio.run_coroutine_threadsafe(
|
||||
self._app._post_message(messages.ExitApp()), loop=self._loop
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user