Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Remove signal dependency (#428)

Kilian Lieret2ae6e971071a
diff --git a/sweagent/environment/utils.py b/sweagent/environment/utils.py
index 0ac2e72b..9ab2a5ad 100644
--- a/sweagent/environment/utils.py
+++ b/sweagent/environment/utils.py
@@ -6,7 +6,6 @@ import logging
import os
import re
import select
-import signal
import subprocess
import tarfile
import tempfile
@@ -213,22 +212,6 @@ def read_with_timeout_experimental(container, timeout_duration):
return body, exit_code
-class timeout:
- def __init__(self, seconds=TIMEOUT_DURATION, error_message="Timeout"):
- self.seconds = seconds
- self.error_message = error_message
-
- def handle_timeout(self, signum, frame):
- raise TimeoutError(self.error_message)
-
- def __enter__(self):
- signal.signal(signal.SIGALRM, self.handle_timeout)
- signal.alarm(self.seconds)
-
- def __exit__(self, type, value, traceback):
- signal.alarm(0)
-
-
def get_background_pids(container_obj):
pids = (
container_obj.exec_run("ps -eo pid,comm --no-headers")