mirror of https://github.com/lapce/lapce.git
Merge pull request #953 from panekj/fix/target-env
fix: pass envvar which libc is used on host
This commit is contained in:
commit
bd8ad59e2a
|
@ -310,6 +310,29 @@ pub fn start_volt(
|
|||
.as_ref()
|
||||
.ok_or_else(|| anyhow!("plugin meta doesn't have dir"))?;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
let volt_libc = {
|
||||
match std::process::Command::new("ldd").arg("--version").output() {
|
||||
Ok(cmd) => {
|
||||
if String::from_utf8_lossy(&cmd.stdout)
|
||||
.to_lowercase()
|
||||
.split_terminator('\n')
|
||||
.next()
|
||||
.unwrap_or("")
|
||||
.contains("musl")
|
||||
{
|
||||
"musl"
|
||||
} else {
|
||||
"glibc"
|
||||
}
|
||||
}
|
||||
_ => "glibc",
|
||||
}
|
||||
};
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
let volt_libc = "";
|
||||
|
||||
let stdin = Arc::new(RwLock::new(WasiPipe::new()));
|
||||
let stdout = Arc::new(RwLock::new(WasiPipe::new()));
|
||||
let stderr = Arc::new(RwLock::new(WasiPipe::new()));
|
||||
|
@ -317,6 +340,7 @@ pub fn start_volt(
|
|||
.inherit_env()?
|
||||
.env("VOLT_OS", std::env::consts::OS)?
|
||||
.env("VOLT_ARCH", std::env::consts::ARCH)?
|
||||
.env("VOLT_LIBC", volt_libc)?
|
||||
.env(
|
||||
"VOLT_URI",
|
||||
Url::from_directory_path(volt_path)
|
||||
|
|
Loading…
Reference in New Issue