Skip to content

Commit

Permalink
fix: remove incorrect exec_run calls
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxqiu committed Jul 28, 2024
1 parent 9802a2c commit 413a5dd
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 @@ -32,7 +32,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 @@ -43,11 +43,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 413a5dd

Please sign in to comment.