fix: check if platform-tool/rust/bin/rustc exists (#32350)

fix: check platform-tool/rust/bin/rustc exist before use
This commit is contained in:
Yihau Chen 2023-07-01 02:28:16 +08:00 committed by GitHub
parent 806d79a643
commit c6574552e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -166,6 +166,9 @@ fn get_base_rust_version(platform_tools_version: &str) -> String {
let target_path =
make_platform_tools_path_for_version("platform-tools", platform_tools_version);
let rustc = target_path.join("rust").join("bin").join("rustc");
if !rustc.exists() {
return String::from("");
}
let args = vec!["--version"];
let output = spawn(&rustc, args, false);
let rustc_re = Regex::new(r"(rustc [0-9]+\.[0-9]+\.[0-9]+).*").unwrap();