Skip to content

Commit 702960d

Browse files
committed
windows fix
1 parent 9ec4d60 commit 702960d

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "textual-serve"
3-
version = "1.0.1"
3+
version = "1.0.2"
44
description = "Turn your Textual TUIs in to web applications"
55
authors = [
66
{ name = "Will McGugan", email = "[email protected]" }

src/textual_serve/server.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import os
77
from pathlib import Path
88
import signal
9+
import sys
910

1011
from typing import Any
1112

@@ -32,6 +33,9 @@
3233
""".replace("VVVVV", f"v{version('textual-serve')}")
3334

3435

36+
WINDOWS = sys.platform == "WINDOWS"
37+
38+
3539
class LogHighlighter(RegexHighlighter):
3640
base_style = "repr."
3741
highlights = [
@@ -173,15 +177,16 @@ def serve(self, debug: bool = False) -> None:
173177
self.initialize_logging()
174178

175179
loop = asyncio.get_event_loop()
176-
loop.add_signal_handler(signal.SIGINT, self.request_exit)
177-
loop.add_signal_handler(signal.SIGTERM, self.request_exit)
180+
if not WINDOWS:
181+
loop.add_signal_handler(signal.SIGINT, self.request_exit)
182+
loop.add_signal_handler(signal.SIGTERM, self.request_exit)
178183
if self.debug:
179184
log.info("Running in debug mode. You may use textual dev tools.")
180185
web.run_app(
181186
self._make_app(),
182187
host=self.host,
183188
port=self.port,
184-
handle_signals=False,
189+
handle_signals=WINDOWS,
185190
loop=loop,
186191
print=lambda *args: None,
187192
)

0 commit comments

Comments
 (0)