...
This commit is contained in:
@@ -34,7 +34,8 @@ impl ContentOperations {
|
||||
|
||||
// Copy the temporary file to the container
|
||||
let temp_path = temp_file.path().to_string_lossy().to_string();
|
||||
execute_buildah_command(&["copy", container_id, &temp_path, dest_path])
|
||||
// Use add instead of copy for better handling of paths
|
||||
execute_buildah_command(&["add", container_id, &temp_path, dest_path])
|
||||
}
|
||||
|
||||
/// Read content from a file in the container
|
||||
@@ -55,7 +56,18 @@ impl ContentOperations {
|
||||
let temp_path = temp_file.path().to_string_lossy().to_string();
|
||||
|
||||
// Copy the file from the container to the temporary file
|
||||
execute_buildah_command(&["copy", container_id, source_path, &temp_path])?;
|
||||
// Use mount to access the container's filesystem
|
||||
let mount_result = execute_buildah_command(&["mount", container_id])?;
|
||||
let mount_point = mount_result.stdout.trim();
|
||||
|
||||
// Construct the full path to the file in the container
|
||||
let full_source_path = format!("{}{}", mount_point, source_path);
|
||||
|
||||
// Copy the file from the mounted container to the temporary file
|
||||
execute_buildah_command(&["copy", container_id, &full_source_path, &temp_path])?;
|
||||
|
||||
// Unmount the container
|
||||
execute_buildah_command(&["umount", container_id])?;
|
||||
|
||||
// Read the content from the temporary file
|
||||
let mut file = File::open(temp_file.path())
|
||||
|
Reference in New Issue
Block a user