Skip to content

Commit 7ccae4b

Browse files
committed
fix: try SIGINT before SIGKILL
1 parent b637af7 commit 7ccae4b

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-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 = "uipath-mcp"
3-
version = "0.0.58"
3+
version = "0.0.59"
44
description = "UiPath MCP SDK"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.10"

src/uipath_mcp/_cli/_runtime/_runtime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ async def cleanup(self) -> None:
156156

157157
# Add a small delay to allow the server to shut down gracefully
158158
if sys.platform == "win32":
159-
await asyncio.sleep(0.1)
159+
await asyncio.sleep(0.5)
160160

161161
async def _handle_signalr_session_closed(self, args: list) -> None:
162162
"""

src/uipath_mcp/_cli/_runtime/_stdio_client.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import signal
12
import sys
23
from contextlib import asynccontextmanager
34
from typing import TextIO
@@ -101,5 +102,14 @@ async def stdin_writer():
101102
with anyio.fail_after(2.0):
102103
await process.wait()
103104
except TimeoutError:
104-
# Force kill if it doesn't terminate
105-
process.kill()
105+
try:
106+
if sys.platform == "win32":
107+
# On Windows, simulate Ctrl+C
108+
process.send_signal(signal.CTRL_C_EVENT)
109+
else:
110+
process.send_signal(signal.SIGINT)
111+
with anyio.fail_after(2.0):
112+
await process.wait()
113+
except TimeoutError:
114+
# Force kill if it doesn't terminate
115+
process.kill()

0 commit comments

Comments
 (0)