mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-07 15:26:49 +01:00
Merge pull request #120382 from LuisPeregrinaIBM2/main
wsl -l -q, removes header and default mark
This commit is contained in:
@@ -174,7 +174,7 @@ async function getWslProfiles(wslPath: string, useWslProfiles?: boolean): Promis
|
||||
if (useWslProfiles) {
|
||||
const distroOutput = await new Promise<string>((resolve, reject) => {
|
||||
// wsl.exe output is encoded in utf16le (ie. A -> 0x4100)
|
||||
cp.exec('wsl.exe -l', { encoding: 'utf16le' }, (err, stdout) => {
|
||||
cp.exec('wsl.exe -l -q', { encoding: 'utf16le' }, (err, stdout) => {
|
||||
if (err) {
|
||||
return reject('Problem occurred when getting wsl distros');
|
||||
}
|
||||
@@ -184,12 +184,7 @@ async function getWslProfiles(wslPath: string, useWslProfiles?: boolean): Promis
|
||||
if (distroOutput) {
|
||||
const regex = new RegExp(/[\r?\n]/);
|
||||
const distroNames = distroOutput.split(regex).filter(t => t.trim().length > 0 && t !== '');
|
||||
// don't need the Windows Subsystem for Linux Distributions header
|
||||
distroNames.shift();
|
||||
for (let distroName of distroNames) {
|
||||
// Remove default from distro name
|
||||
distroName = distroName.replace(/ \(Default\)$/, '');
|
||||
|
||||
// Skip empty lines
|
||||
if (distroName === '') {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user