Skip to content

Commit b87da57

Browse files
authored
Merge pull request microsoft#157328 from microsoft/tyriar/1_70_157083
[1.70] Ignore pwsh shell integration script errors on Windows
2 parents c7ad4a4 + 11117a2 commit b87da57

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/vs/platform/terminal/node/terminalEnvironment.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,9 @@ export enum ShellIntegrationExecutable {
223223
}
224224

225225
export const shellIntegrationArgs: Map<ShellIntegrationExecutable, string[]> = new Map();
226-
shellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwsh, ['-noexit', '-command', '. \"{0}\\out\\vs\\workbench\\contrib\\terminal\\browser\\media\\shellIntegration.ps1\"{1}']);
227-
shellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwshLogin, ['-l', '-noexit', '-command', '. \"{0}\\out\\vs\\workbench\\contrib\\terminal\\browser\\media\\shellIntegration.ps1\"{1}']);
226+
// The try catch swallows execution policy errors in the case of the archive distributable
227+
shellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwsh, ['-noexit', '-command', 'try { . \"{0}\\out\\vs\\workbench\\contrib\\terminal\\browser\\media\\shellIntegration.ps1\" } catch {}{1}']);
228+
shellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwshLogin, ['-l', '-noexit', '-command', 'try { . \"{0}\\out\\vs\\workbench\\contrib\\terminal\\browser\\media\\shellIntegration.ps1\" } catch {}{1}']);
228229
shellIntegrationArgs.set(ShellIntegrationExecutable.Pwsh, ['-noexit', '-command', '. "{0}/out/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1"{1}']);
229230
shellIntegrationArgs.set(ShellIntegrationExecutable.PwshLogin, ['-l', '-noexit', '-command', '. "{0}/out/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1"']);
230231
shellIntegrationArgs.set(ShellIntegrationExecutable.Zsh, ['-i']);

0 commit comments

Comments
 (0)