File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,25 @@ pub fn ensure_version_or_cargo_install(
7676 bin_name : & str ,
7777 version : & str ,
7878) -> io:: Result < PathBuf > {
79+ // ignore the process exit code here and instead just let the version number check fail.
80+ // we also importantly don't return if the program wasn't installed,
81+ // instead we want to continue to the fallback.
82+ ' ck: {
83+ // FIXME: rewrite as if-let chain once this crate is 2024 edition.
84+ let Ok ( output) = Command :: new ( bin_name) . arg ( "--version" ) . output ( ) else {
85+ break ' ck;
86+ } ;
87+ let Ok ( s) = str:: from_utf8 ( & output. stdout ) else {
88+ break ' ck;
89+ } ;
90+ let Some ( v) = s. trim ( ) . split_whitespace ( ) . last ( ) else {
91+ break ' ck;
92+ } ;
93+ if v == version {
94+ return Ok ( PathBuf :: from ( bin_name) ) ;
95+ }
96+ }
97+
7998 let tool_root_dir = build_dir. join ( "misc-tools" ) ;
8099 let tool_bin_dir = tool_root_dir. join ( "bin" ) ;
81100 // use --force to ensure that if the required version is bumped, we update it.
You can’t perform that action at this time.
0 commit comments