Detect WSL1 and error (#297)
* Detect WSL1 and error WSL1 is not supported because some things Nix relies on to work are not available. * Update linux.rs * Add link to MS docs on WSL1 -> WSL2 upgrade
This commit is contained in:
parent
3be93c54f6
commit
d7c14d6695
|
@ -39,6 +39,10 @@ impl Planner for Linux {
|
|||
return Err(PlannerError::NixOs);
|
||||
}
|
||||
|
||||
if std::env::var("WSL_DISTRO_NAME").is_ok() && std::env::var("WSL_INTEROP").is_err() {
|
||||
return Err(PlannerError::Wsl1);
|
||||
}
|
||||
|
||||
// We currently do not support SELinux
|
||||
match Command::new("getenforce").output().await {
|
||||
Ok(output) => {
|
||||
|
|
|
@ -301,6 +301,8 @@ pub enum PlannerError {
|
|||
NixOs,
|
||||
#[error("`nix` is already a valid command, so it is installed")]
|
||||
NixExists,
|
||||
#[error("WSL1 is not supported, please upgrade to WSL2: https://learn.microsoft.com/en-us/windows/wsl/install#upgrade-version-from-wsl-1-to-wsl-2")]
|
||||
Wsl1,
|
||||
}
|
||||
|
||||
impl HasExpectedErrors for PlannerError {
|
||||
|
@ -315,6 +317,7 @@ impl HasExpectedErrors for PlannerError {
|
|||
PlannerError::Custom(_) => None,
|
||||
this @ PlannerError::NixOs => Some(Box::new(this)),
|
||||
this @ PlannerError::NixExists => Some(Box::new(this)),
|
||||
this @ PlannerError::Wsl1 => Some(Box::new(this)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue