cli: skip glibc check for nixos

Fixes https://github.com/microsoft/vscode-remote-release/issues/7129
This commit is contained in:
Connor Peet 2022-11-11 13:32:41 -08:00
parent f8995e0b1a
commit 0cd1422809
No known key found for this signature in database
GPG key ID: CF8FD2EA0DBC61BD

View file

@ -23,6 +23,8 @@ lazy_static! {
static ref MIN_LDD_VERSION: SimpleSemver = SimpleSemver::new(2, 17, 0);
}
const NIXOS_TEST_PATH: &str = "/etc/NIXOS";
pub struct PreReqChecker {}
impl Default for PreReqChecker {
@ -45,13 +47,14 @@ impl PreReqChecker {
#[cfg(target_os = "linux")]
pub async fn verify(&self) -> Result<Platform, AnyError> {
let (gnu_a, gnu_b, or_musl) = tokio::join!(
let (is_nixos, gnu_a, gnu_b, or_musl) = tokio::join!(
check_is_nixos(),
check_glibc_version(),
check_glibcxx_version(),
check_musl_interpreter()
);
if gnu_a.is_ok() && gnu_b.is_ok() {
if (gnu_a.is_ok() && gnu_b.is_ok()) || is_nixos {
return Ok(if cfg!(target_arch = "x86_64") {
Platform::LinuxX64
} else if cfg!(target_arch = "armhf") {
@ -132,6 +135,13 @@ async fn check_glibc_version() -> Result<(), String> {
Ok(())
}
/// Check for nixos to avoid mandating glibc versions. See:
/// https://github.com/microsoft/vscode-remote-release/issues/7129
#[allow(dead_code)]
async fn check_is_nixos() -> bool {
fs::metadata(NIXOS_TEST_PATH).await.is_ok()
}
#[allow(dead_code)]
async fn check_glibcxx_version() -> Result<(), String> {
let mut libstdc_path: Option<String> = None;