-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Download expected
bb
version if installed backend has version …
…mismatch (#3150) Co-authored-by: Tom French <tom@tomfren.ch>
- Loading branch information
1 parent
463d40b
commit 2220eef
Showing
7 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use std::path::Path; | ||
|
||
use crate::BackendError; | ||
|
||
use super::string_from_stderr; | ||
|
||
/// VersionCommand will call the backend binary | ||
/// to query installed version. | ||
pub(crate) struct VersionCommand; | ||
|
||
impl VersionCommand { | ||
pub(crate) fn run(self, binary_path: &Path) -> Result<String, BackendError> { | ||
let mut command = std::process::Command::new(binary_path); | ||
|
||
command.arg("--version"); | ||
|
||
let output = command.output()?; | ||
if output.status.success() { | ||
match String::from_utf8(output.stdout) { | ||
Ok(result) => Ok(result), | ||
Err(_) => Err(BackendError::CommandFailed( | ||
"Unexpected output from --version check.".to_owned(), | ||
)), | ||
} | ||
} else { | ||
Err(BackendError::CommandFailed(string_from_stderr(&output.stderr))) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters