Skip to content

Commit

Permalink
fix: remove incorrect exec_run calls (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxqiu authored Feb 12, 2025
1 parent 6d7ba04 commit 80d4550
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions swebench/harness/docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def copy_to_container(container: Container, src: Path, dst: Path):
# temporary tar file
tar_path = src.with_suffix(".tar")
with tarfile.open(tar_path, "w") as tar:
tar.add(src, arcname=src.name)
tar.add(src, arcname=dst.name) # use destination name, so after `put_archive`, name is correct

# get bytes for put_archive cmd
with open(tar_path, "rb") as tar_file:
Expand All @@ -44,11 +44,9 @@ def copy_to_container(container: Container, src: Path, dst: Path):

# Send tar file to container and extract
container.put_archive(os.path.dirname(dst), data)
container.exec_run(f"tar -xf {dst}.tar -C {dst.parent}")

# clean up in locally and in container
tar_path.unlink()
container.exec_run(f"rm {dst}.tar")


def write_to_container(container: Container, data: str, dst: Path):
Expand Down

0 comments on commit 80d4550

Please sign in to comment.