Wrap WSL distro uninstall to avoid installer crashes

This commit is contained in:
Difegue 2024-09-02 15:35:01 +02:00
parent b653815ddf
commit 216471b2ae

View File

@ -133,8 +133,15 @@ namespace Setup
return session.HandleErrors(() =>
{
session.Log("Removing previous WSL Distro");
var wslProc = Process.Start("wslconfig.exe", "/unregister lanraragi");
wslProc.WaitForExit();
try {
var wslProc = Process.Start("wslconfig.exe", "/unregister lanraragi");
wslProc.WaitForExit();
} catch (Exception e)
{
// Just log the error. We don't want to crash the uninstaller because of this.
session.Log("Error while removing WSL Distro: " + e.Message);
}
});
}