From f0b8f9d5b9c0b5153365525a74d16fb5039229be Mon Sep 17 00:00:00 2001 From: Erwan Leroy Date: Tue, 4 Jul 2023 13:56:08 -0700 Subject: [PATCH] Add Execution Policy setting to Powershell based shell plugins --- src/rezplugins/shell/_utils/powershell_base.py | 5 +++++ src/rezplugins/shell/rezconfig | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/rezplugins/shell/_utils/powershell_base.py b/src/rezplugins/shell/_utils/powershell_base.py index 18759d1023..43d7f2bb71 100644 --- a/src/rezplugins/shell/_utils/powershell_base.py +++ b/src/rezplugins/shell/_utils/powershell_base.py @@ -202,6 +202,11 @@ def _record_shell(ex, files, bind_rez=True, print_msg=False): # Suppresses copyright message of PowerShell and pwsh cmd += ["-NoLogo"] + # Powershell execution policy overrides + execution_policy = self.settings.execution_policy + if execution_policy: + cmd += ["-ExecutionPolicy", execution_policy] + # Generic form of sourcing that works in powershell and pwsh cmd += ["-File", target_file] diff --git a/src/rezplugins/shell/rezconfig b/src/rezplugins/shell/rezconfig index c8d509fac0..392a8b6552 100644 --- a/src/rezplugins/shell/rezconfig +++ b/src/rezplugins/shell/rezconfig @@ -27,11 +27,13 @@ powershell: prompt: '> $ ' additional_pathext: ['.PY'] executable_fullpath: null + execution_policy: null pwsh: prompt: '> $ ' additional_pathext: ['.PY'] executable_fullpath: null + execution_policy: null gitbash: prompt: '>'