Skip to content

Commit

Permalink
windows fix
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Jun 19, 2024
1 parent 9ec4d60 commit 702960d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "textual-serve"
version = "1.0.1"
version = "1.0.2"
description = "Turn your Textual TUIs in to web applications"
authors = [
{ name = "Will McGugan", email = "[email protected]" }
Expand Down
11 changes: 8 additions & 3 deletions src/textual_serve/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
from pathlib import Path
import signal
import sys

from typing import Any

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


WINDOWS = sys.platform == "WINDOWS"


class LogHighlighter(RegexHighlighter):
base_style = "repr."
highlights = [
Expand Down Expand Up @@ -173,15 +177,16 @@ def serve(self, debug: bool = False) -> None:
self.initialize_logging()

loop = asyncio.get_event_loop()
loop.add_signal_handler(signal.SIGINT, self.request_exit)
loop.add_signal_handler(signal.SIGTERM, self.request_exit)
if not WINDOWS:
loop.add_signal_handler(signal.SIGINT, self.request_exit)
loop.add_signal_handler(signal.SIGTERM, self.request_exit)
if self.debug:
log.info("Running in debug mode. You may use textual dev tools.")
web.run_app(
self._make_app(),
host=self.host,
port=self.port,
handle_signals=False,
handle_signals=WINDOWS,
loop=loop,
print=lambda *args: None,
)
Expand Down

0 comments on commit 702960d

Please sign in to comment.