Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bcd825b

Browse files
Add developer setting to disable -ExecutionPolicy Bypass flags
1 parent 18a8f83 commit bcd825b

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

‎package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,11 @@
957957
"default": false,
958958
"markdownDescription": "Launches the LSP server with the `/waitForDebugger` flag to force it to wait for a .NET debugger to attach before proceeding, and emit its PID until then. **This setting is only meant for extension developers and requires the extension to be run in development mode!**"
959959
},
960+
"powershell.developer.setExecutionPolicy": {
961+
"type": "boolean",
962+
"default": true,
963+
"markdownDescription": "On Windows we launch the PowerShell executable with `-ExecutionPolicy Bypass` so that the LSP server (PowerShell Editor Services module) will launch without issue. Some anti-virus programs disallow this command-line argument and this flag can be used to remove it. **Using this setting may require trusting the script manually in order for it to launch!**"
964+
},
960965
"powershell.developer.featureFlags": {
961966
"type": "array",
962967
"items": {

‎src/process.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class PowerShellProcess {
7171
powerShellArgs.push("-NoProfile");
7272

7373
// Only add ExecutionPolicy param on Windows
74-
if (utils.isWindows) {
74+
if (utils.isWindows&&this.sessionSettings.developer.setExecutionPolicy) {
7575
powerShellArgs.push("-ExecutionPolicy", "Bypass");
7676
}
7777

‎src/session.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ export class SessionManager implements Middleware {
449449
|| settings.developer.editorServicesLogLevel !== this.sessionSettings.developer.editorServicesLogLevel
450450
|| settings.developer.bundledModulesPath !== this.sessionSettings.developer.bundledModulesPath
451451
|| settings.developer.editorServicesWaitForDebugger !== this.sessionSettings.developer.editorServicesWaitForDebugger
452+
|| settings.developer.setExecutionPolicy !== this.sessionSettings.developer.setExecutionPolicy
452453
|| settings.integratedConsole.useLegacyReadLine !== this.sessionSettings.integratedConsole.useLegacyReadLine
453454
|| settings.integratedConsole.startInBackground !== this.sessionSettings.integratedConsole.startInBackground
454455
|| settings.integratedConsole.startLocation !== this.sessionSettings.integratedConsole.startLocation)) {

‎src/settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class DeveloperSettings extends PartialSettings {
116116
bundledModulesPath = "../../PowerShellEditorServices/module";
117117
editorServicesLogLevel = LogLevel.Normal;
118118
editorServicesWaitForDebugger = false;
119+
setExecutionPolicy = true;
119120
waitForSessionFileTimeoutSeconds = 240;
120121
}
121122

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /