Skip to content

Commit f13becf

Browse files
committed
Add error message when failing to copy Bazel output
1 parent 391f36f commit f13becf

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tensorflow-sys/build.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -398,15 +398,23 @@ fn build_from_src() {
398398
framework_library_path
399399
);
400400
if framework_library_path.exists() {
401-
fs::remove_file(&framework_library_path).unwrap();
401+
fs::remove_file(&framework_library_path)
402+
.expect(&format!("{:?} should be removable", framework_library_path));
402403
}
403-
fs::copy(framework_target_bazel_bin, &framework_library_path).unwrap();
404+
fs::copy(&framework_target_bazel_bin, &framework_library_path).expect(&format!(
405+
"{:?} should be copyable to {:?}",
406+
framework_target_bazel_bin, framework_library_path
407+
));
404408
let target_bazel_bin = source.join("bazel-bin").join(target_path);
405409
log!("Copying {:?} to {:?}", target_bazel_bin, library_path);
406410
if library_path.exists() {
407-
fs::remove_file(&library_path).unwrap();
411+
fs::remove_file(&library_path)
412+
.expect(&format!("{:?} should be removable", library_path));
408413
}
409-
fs::copy(target_bazel_bin, &library_path).unwrap();
414+
fs::copy(&target_bazel_bin, &library_path).expect(&format!(
415+
"{:?} should be copyable to {:?}",
416+
target_bazel_bin, library_path
417+
));
410418
}
411419
symlink(
412420
framework_library_path.file_name().unwrap(),

0 commit comments

Comments
 (0)