Skip to content

Commit

Permalink
Fixed error when deleting distros
Browse files Browse the repository at this point in the history
  • Loading branch information
bostrot committed Feb 12, 2023
1 parent bc1b73f commit beff2a0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/api/wsl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,8 @@ class WSLApi {
return results;
}

var lastDistroList = Instances([], []);

/// Returns list of WSL distros
/// @return Future<Instances>
Future<Instances> list(bool showDocker) async {
Expand All @@ -656,6 +658,9 @@ class WSLApi {
wslInstalled = false;
}
if (wslInstalled) {
if (output.contains('ERROR_FILE_NOT_FOUND')) {
return lastDistroList;
}
output.split('\n').forEach((line) {
var dockerfilter = showDocker
? true
Expand All @@ -667,6 +672,7 @@ class WSLApi {
}
});
List<String> running = await listRunning();
lastDistroList = Instances(list, running);
return Instances(list, running);
} else {
return Instances(['wslNotInstalled'], []);
Expand Down

0 comments on commit beff2a0

Please # to comment.