start method
Start a WSL distro by name
Implementation
void start(String distribution,
{String startPath = '',
String startUser = '',
String startCmd = ''}) async {
List<String> args = ['wsl', '-d', distribution];
if (startPath != '') {
args.addAll(['--cd', startPath]);
}
if (startUser != '') {
args.addAll(['--user', startUser]);
}
if (startCmd != '') {
for (String cmd in startCmd.split(' ')) {
args.add(cmd);
}
// Run shell to keep open
args.add(';/bin/sh');
}
await Process.start('start', args,
mode: ProcessStartMode.detached, runInShell: true);
if (kDebugMode) {
print("Done starting $distribution");
}
}