Skip to content

Commit d00e1cd

Browse files
committed
Fix: Cannot reach RuntimeError with check=True
1 parent f5ae7cd commit d00e1cd

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

codeclash/games/utils.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ def copy_between_containers(
2727
str(temp_path),
2828
]
2929
result_src = subprocess.run(
30-
cmd_src, check=True, stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL
30+
cmd_src, check=False, capture_output=True, text=True
3131
)
3232
if result_src.returncode != 0:
3333
raise RuntimeError(
34-
f"Failed to copy from {src_container.container_id} to local temp"
34+
f"Failed to copy from {src_container.container_id} to local temp: {result_src.stdout}{result_src.stderr}"
3535
)
3636

3737
# Ensure destination folder exists
@@ -47,11 +47,11 @@ def copy_between_containers(
4747
f"{dest_container.container_id}:{dest_path}",
4848
]
4949
result_dest = subprocess.run(
50-
cmd_dest, check=True, stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL
50+
cmd_dest, check=False, capture_output=True, text=True
5151
)
5252
if result_dest.returncode != 0:
5353
raise RuntimeError(
54-
f"Failed to copy from local temp to {dest_container.container_id}"
54+
f"Failed to copy from local temp to {dest_container.container_id}: {result_dest.stdout}{result_dest.stderr}"
5555
)
5656

5757

@@ -71,10 +71,8 @@ def copy_file_to_container(
7171
str(src_path),
7272
f"{container.container_id}:{dest_path}",
7373
]
74-
result = subprocess.run(
75-
cmd, check=True, stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL
76-
)
74+
result = subprocess.run(cmd, check=False, capture_output=True, text=True)
7775
if result.returncode != 0:
7876
raise RuntimeError(
79-
f"Failed to copy {src_path} to {container.container_id}:{dest_path}"
77+
f"Failed to copy {src_path} to {container.container_id}:{dest_path}: {result.stdout}{result.stderr}"
8078
)

0 commit comments

Comments
 (0)