Verify target triple retrieved from rustc is valid (#637)

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-12-29 11:42:54 +11:00 committed by GitHub
parent 287ae03a51
commit 31c9d4de1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -95,4 +95,6 @@ async fn get_target_from_rustc() -> Option<String> {
.lines()
.filter_map(|line| line.ok())
.find_map(|line| line.strip_prefix("host: ").map(|host| host.to_owned()))
// All valid target triple must be in the form of $arch-$os-$abi.
.filter(|target| target.split('-').count() >= 3)
}