From 7484373c9d26ed5cbabb57ed033893540db70008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Kautler?= Date: Thu, 16 Jun 2022 19:50:01 +0200 Subject: [PATCH] Set default WSL version to 1 before install (#28) In windows-2022 environment WSLv2 is now generally available and the default, but it cannot work as GitHub actions are running on Azure cloud where nested Hyper-V virtualization is not available. GitHub will change the default WSL version back to WSLv1 in a future update but to be future proof and not break again in case WSLv2 becomes properly available in the future, we force it additionally in the action. --- .../kotlin/net/kautler/github/action/setup_wsl/SetupWsl.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/kotlin/net/kautler/github/action/setup_wsl/SetupWsl.kt b/src/main/kotlin/net/kautler/github/action/setup_wsl/SetupWsl.kt index 90eea344..fdd1bc3b 100644 --- a/src/main/kotlin/net/kautler/github/action/setup_wsl/SetupWsl.kt +++ b/src/main/kotlin/net/kautler/github/action/setup_wsl/SetupWsl.kt @@ -284,6 +284,10 @@ suspend fun verifyWindowsEnvironment() { } suspend fun installDistribution() { + exec( + commandLine = "wsl", + args = arrayOf("--set-default-version", "1"), + ).await() exec( commandLine = """"${path.join(distributionDirectory(), distribution.installerFile)}"""", args = arrayOf("install", "--root"),