mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(code-execution): close server socket in finally block to prevent fd leak
This commit is contained in:
parent
f75b1d21b4
commit
a857321463
1 changed files with 4 additions and 1 deletions
|
|
@ -502,7 +502,6 @@ def execute_code(
|
|||
duration = round(time.monotonic() - exec_start, 2)
|
||||
|
||||
# Wait for RPC thread to finish
|
||||
server_sock.close()
|
||||
rpc_thread.join(timeout=3)
|
||||
|
||||
# Build response
|
||||
|
|
@ -538,6 +537,10 @@ def execute_code(
|
|||
|
||||
finally:
|
||||
# Cleanup temp dir and socket
|
||||
try:
|
||||
server_sock.close()
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
import shutil
|
||||
shutil.rmtree(tmpdir, ignore_errors=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue