aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/installer/binary_installer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/installer/binary_installer.rs')
-rw-r--r--crates/shirabe/src/installer/binary_installer.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/crates/shirabe/src/installer/binary_installer.rs b/crates/shirabe/src/installer/binary_installer.rs
index b9c56f6..8e7ade5 100644
--- a/crates/shirabe/src/installer/binary_installer.rs
+++ b/crates/shirabe/src/installer/binary_installer.rs
@@ -169,9 +169,14 @@ impl BinaryInstaller {
return "call".to_string();
}
- let handle = fopen(bin, "r");
- let line = fgets(handle.clone()).unwrap_or_default();
- fclose(handle);
+ let line = match fopen(bin, "r") {
+ Ok(handle) => {
+ let line = fgets(&handle, None).unwrap_or_default();
+ fclose(&handle);
+ line
+ }
+ Err(_) => String::new(),
+ };
let mut m: IndexMap<CaptureKey, String> = IndexMap::new();
if Preg::is_match3(
r"{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m",