From 2c9ca99a102e89ea16faa0d8b2f44a5a9010981d Mon Sep 17 00:00:00 2001 From: Joshua Janicas Date: Wed, 5 Jun 2024 11:15:20 -0400 Subject: [PATCH 1/2] fix: do not support add_signal_handler if win32 --- 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..a7aa06b 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] = [] From 1c2b1fc4156a6a5171d7cd1ba5ce121b65384bf7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 5 Jun 2024 15:35:47 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- meltano/edk/process.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meltano/edk/process.py b/meltano/edk/process.py index a7aa06b..631070b 100644 --- a/meltano/edk/process.py +++ b/meltano/edk/process.py @@ -138,7 +138,7 @@ async def _exec( loop = asyncio.get_event_loop() # Windows does not support add_signal_handler # https://docs.python.org/3/library/asyncio-platforms.html - if sys.platform != 'win32': + if sys.platform != "win32": loop.add_signal_handler( signal.SIGINT, lambda s=signal.SIGINT: p.send_signal(s), # type: ignore[misc]