From c5dc08d6906d4b4baed5df9140ed2e34755ef22d Mon Sep 17 00:00:00 2001 From: joshua-janicas Date: Thu, 6 Jun 2024 12:19:43 -0400 Subject: [PATCH] fix: Do not use `add_signal_handler` on Windows (#274) --- meltano/edk/process.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/meltano/edk/process.py b/meltano/edk/process.py index 90275c7..631070b 100644 --- a/meltano/edk/process.py +++ b/meltano/edk/process.py @@ -6,6 +6,7 @@ import os import signal import subprocess +import sys import typing as t import structlog @@ -135,10 +136,13 @@ async def _exec( ) loop = asyncio.get_event_loop() - loop.add_signal_handler( - signal.SIGINT, - lambda s=signal.SIGINT: p.send_signal(s), # type: ignore[misc] - ) + # Windows does not support add_signal_handler + # https://docs.python.org/3/library/asyncio-platforms.html + if sys.platform != "win32": + loop.add_signal_handler( + signal.SIGINT, + lambda s=signal.SIGINT: p.send_signal(s), # type: ignore[misc] + ) streams: list[asyncio.streams.StreamReader] = []