File tree Expand file tree Collapse file tree 2 files changed +25
-11
lines changed
src/uipath_mcp/_cli/_runtime Expand file tree Collapse file tree 2 files changed +25
-11
lines changed Original file line number Diff line number Diff line change 11[project ]
22name = " uipath-mcp"
3- version = " 0.0.59 "
3+ version = " 0.0.60 "
44description = " UiPath MCP SDK"
55readme = { file = " README.md" , content-type = " text/markdown" }
66requires-python = " >=3.10"
Original file line number Diff line number Diff line change @@ -98,18 +98,32 @@ async def stdin_writer():
9898 finally :
9999 # Clean up process to prevent any dangling orphaned processes
100100 try :
101+ # Cancel the task group to stop readers/writers
102+ tg .cancel_scope .cancel ()
103+ # Close the pipes explicitly to prevent ResourceWarnings
104+ if hasattr (process , "stdin" ) and process .stdin :
105+ process .stdin .close ()
106+ if hasattr (process , "stdout" ) and process .stdout :
107+ process .stdout .close ()
108+ if hasattr (process , "stderr" ) and process .stderr :
109+ process .stderr .close ()
110+ # Then terminate the process with escalating signals
101111 process .terminate ()
102- with anyio .fail_after (2.0 ):
103- await process .wait ()
104- except TimeoutError :
105112 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 )
111113 with anyio .fail_after (2.0 ):
112114 await process .wait ()
113115 except TimeoutError :
114- # Force kill if it doesn't terminate
115- process .kill ()
116+ try :
117+ if sys .platform == "win32" :
118+ process .send_signal (signal .CTRL_C_EVENT )
119+ else :
120+ process .send_signal (signal .SIGINT )
121+ with anyio .fail_after (2.0 ):
122+ await process .wait ()
123+ except TimeoutError :
124+ # Force kill if it doesn't terminate
125+ process .kill ()
126+ # Give the event loop a chance to clean up
127+ await anyio .sleep (0.1 )
128+ except Exception :
129+ pass
You can’t perform that action at this time.
0 commit comments