Skip to content

Commit 8afc196

Browse files
author
Paul C
committed
fix: WolfUSB install reports failure when binary is actually installed
1 parent 9e0e50c commit 8afc196

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/wolfusb/mod.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,19 @@ pub async fn install() -> Result<String, String> {
139139

140140
let stdout = String::from_utf8_lossy(&output.stdout).to_string();
141141
let stderr = String::from_utf8_lossy(&output.stderr).to_string();
142+
let combined = format!("{}\n{}", stdout, stderr);
142143

143-
if output.status.success() {
144+
// Check if the binary actually exists (installer may exit non-zero due to
145+
// harmless shell issues like unbound variables even when install succeeded)
146+
if is_installed() {
144147
info!("WolfUSB: installed successfully");
145-
Ok(format!("{}\n{}", stdout, stderr))
148+
Ok(combined)
149+
} else if output.status.success() {
150+
info!("WolfUSB: installed successfully");
151+
Ok(combined)
146152
} else {
147153
warn!("WolfUSB: installation failed");
148-
Err(format!("Installation failed:\n{}\n{}", stdout, stderr))
154+
Err(format!("Installation failed:\n{}", combined))
149155
}
150156
}
151157

0 commit comments

Comments
 (0)