mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-05-01 23:35:52 +00:00
Merge PR #851: wait for killed process after shell timeout to prevent fd leaks
This commit is contained in:
commit
c1296746e3
@ -81,6 +81,12 @@ class ExecTool(Tool):
|
|||||||
)
|
)
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
process.kill()
|
process.kill()
|
||||||
|
# Wait for the process to fully terminate so pipes are
|
||||||
|
# drained and file descriptors are released.
|
||||||
|
try:
|
||||||
|
await asyncio.wait_for(process.wait(), timeout=5.0)
|
||||||
|
except asyncio.TimeoutError:
|
||||||
|
pass
|
||||||
return f"Error: Command timed out after {self.timeout} seconds"
|
return f"Error: Command timed out after {self.timeout} seconds"
|
||||||
|
|
||||||
output_parts = []
|
output_parts = []
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user