331
}
332
}
334
>
if (!executable) {
335
return originalPath;
336
}
338
>
const hasSpace = originalPath.includes(' ');
339
>
const hasParens = originalPath.includes('(') || originalPath.includes(')');
340
>
341
>
const pathBasename = path.basename(executable, '.exe');
342
>
const isPowerShell = pathBasename === 'pwsh' ||
343
title === 'pwsh' ||
344
pathBasename === 'powershell' ||
345
title === 'powershell';
347
>
if (isPowerShell && (hasSpace || originalPath.includes('\''))) {
348
return `& '${originalPath.replace(/'/g, '\'\'')}'`;
349
}
351
>
if (hasParens && isPowerShell) {
352
return `& '${originalPath}'`;
353
}
355
>
if (os === OperatingSystem.Windows) {
356
// 17063 is the build number where wsl path was introduced.
357
// Update Windows uriPath to be executed in WSL.