fix: use subprocess instead of os.system in local_backend.py (#2494)

* fix: use subprocess instead of os.system in local_backend.py

The sandbox backend and skill evaluation scripts use subprocess

* fixing the failing test

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
This commit is contained in:
orbisai0security 2026-04-25 06:29:31 +05:30 committed by GitHub
parent 2bb1a2dfa2
commit 950821cb9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -288,10 +288,10 @@ class LocalSandbox(Sandbox):
timeout=600, timeout=600,
) )
else: else:
args = [shell, "-c", resolved_command]
result = subprocess.run( result = subprocess.run(
resolved_command, args,
executable=shell, shell=False,
shell=True,
capture_output=True, capture_output=True,
text=True, text=True,
timeout=600, timeout=600,

View File

@ -255,7 +255,9 @@ class TestMultipleMounts:
sandbox.execute_command("cat /mnt/data/test.txt") sandbox.execute_command("cat /mnt/data/test.txt")
# Verify the command received the resolved local path # Verify the command received the resolved local path
assert str(data_dir) in captured.get("command", "") command = captured.get("command", [])
assert isinstance(command, list) and len(command) >= 3
assert str(data_dir) in command[2]
def test_reverse_resolve_path_does_not_match_partial_prefix(self, tmp_path): def test_reverse_resolve_path_does_not_match_partial_prefix(self, tmp_path):
foo_dir = tmp_path / "foo" foo_dir = tmp_path / "foo"