Skip to content

Commit dd90fbc

Browse files
committed
Revert "Maybe fixing our mega bug?"
This reverts commit 68717dd.
1 parent 68717dd commit dd90fbc

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

codeclash/utils/environment.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ def copy_between_containers(
2424
"""
2525
Copy files from one Docker container to another via a temporary local directory.
2626
"""
27-
if Path(src_path).is_dir():
28-
src_path = f"{src_path}/"
29-
dest_path = f"{dest_path}/"
3027
with tempfile.TemporaryDirectory() as temp_dir:
3128
temp_path = Path(temp_dir) / Path(src_path).name
3229

@@ -35,10 +32,9 @@ def copy_between_containers(
3532
"docker",
3633
"cp",
3734
f"{src_container.container_id}:{src_path}",
38-
f"{temp_path}",
35+
str(temp_path),
3936
]
4037
result_src = subprocess.run(cmd_src, check=False, capture_output=True, text=True)
41-
print(result_src)
4238
if result_src.returncode != 0:
4339
raise RuntimeError(
4440
f"Failed to copy from {src_container.container_id} to local temp: {result_src.stdout}{result_src.stderr}"
@@ -51,11 +47,10 @@ def copy_between_containers(
5147
cmd_dest = [
5248
"docker",
5349
"cp",
54-
f"{temp_path}",
50+
str(temp_path),
5551
f"{dest_container.container_id}:{dest_path}",
5652
]
5753
result_dest = subprocess.run(cmd_dest, check=False, capture_output=True, text=True)
58-
print(result_dest)
5954
if result_dest.returncode != 0:
6055
raise RuntimeError(
6156
f"Failed to copy from local temp to {dest_container.container_id}: {result_dest.stdout}{result_dest.stderr}"
@@ -72,17 +67,13 @@ def copy_to_container(
7267
7368
The copy operation is recursive for directories.
7469
"""
75-
# ALWAYS ADD TRAILING SLASHES EVERYWHERE
76-
if Path(src_path).is_dir():
77-
src_path = f"{src_path}/"
78-
dest_path = f"{dest_path}/"
7970
if not str(dest_path).startswith("/"):
8071
# If not an absolute path, assume relative to container's cwd
81-
dest_path = f"{container.config.cwd}/{dest_path}/"
72+
dest_path = f"{container.config.cwd}/{dest_path}"
8273
cmd = [
8374
"docker",
8475
"cp",
85-
f"{src_path}",
76+
str(src_path),
8677
f"{container.container_id}:{dest_path}",
8778
]
8879
# Ensure destination folder exists
@@ -105,12 +96,11 @@ def copy_from_container(
10596
10697
The copy operation is recursive for directories.
10798
"""
108-
# ALWAYS ADD TRAILING SLASHES EVERYWHERE
10999
cmd = [
110100
"docker",
111101
"cp",
112102
f"{container.container_id}:{src_path}",
113-
f"{dest_path}/",
103+
str(dest_path),
114104
]
115105
Path(dest_path).parent.mkdir(parents=True, exist_ok=True)
116106
result = subprocess.run(cmd, check=False, capture_output=True, text=True)

0 commit comments

Comments
 (0)