Skip to content

Commit f771678

Browse files
committed
fix: avoid no child pid kill
1 parent 0920200 commit f771678

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

bigcodebench/eval/utils.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,19 +225,16 @@ def safe_exec(*args, **kwargs):
225225
for pid in child_pids:
226226
try:
227227
os.kill(pid, signal.SIGTERM)
228-
# Wait for a short time to see if the process terminates
229-
for _ in range(10): # Wait up to 1 second
228+
for _ in range(10):
230229
time.sleep(0.1)
231230
try:
232-
# Check if the process has terminated
233231
os.kill(pid, 0)
234232
except ProcessLookupError:
235-
break # Process has terminated
233+
break
236234
else:
237-
# If the process didn't terminate, try SIGKILL
238235
os.kill(pid, signal.SIGKILL)
239236
except ProcessLookupError:
240-
pass # Process already terminated
237+
pass
241238
except Exception as e:
242239
print(f"Error handling process {pid}: {e}")
243240

0 commit comments

Comments
 (0)