GTW-8754: re-add missing ipv4 preference for wsl in native launcher

GitOrigin-RevId: ef24762d790cd2671cf36819cf3527b486c6bd44
This commit is contained in:
Nikolay Kuznetsov
2024-05-22 15:09:07 +02:00
committed by intellij-monorepo-bot
parent 46121e11bc
commit f85ff34eeb

View File

@@ -31,6 +31,11 @@ impl LaunchConfiguration for RemoteDevLaunchConfiguration {
// TODO: add default Xmx to productInfo as right now we patch the user one
vm_options.push("-Xmx2048m".to_string());
#[cfg(target_os = "linux")]
if is_wsl2() && !parse_bool_env_var("REMOTE_DEV_SERVER_ALLOW_IPV6_ON_WSL2", false)? {
vm_options.push("-Djava.net.preferIPv4Stack=true".to_string())
}
Ok(vm_options)
}
@@ -611,3 +616,10 @@ fn preload_native_libs(ide_home_dir: &PathBuf) -> Result<()> {
Ok(())
}
#[cfg(target_os = "linux")]
fn is_wsl2() -> bool {
fs::read_to_string("/proc/sys/kernel/osrelease")
.map(|x| x.contains("WSL2"))
.unwrap_or(false)
}