File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 11{
2+ "version" : " 2.0" ,
23 "logger" : {
34 "categoryFilter" : {
45 "defaultLevel" : " Trace" ,
Original file line number Diff line number Diff line change @@ -28,7 +28,14 @@ internal class PowerShellManager
2828 internal PowerShellManager ( RpcLogger logger )
2929 {
3030 var initialSessionState = InitialSessionState . CreateDefault ( ) ;
31- initialSessionState . ExecutionPolicy = Microsoft . PowerShell . ExecutionPolicy . Unrestricted ;
31+
32+ // Setting the execution policy on macOS and Linux throws an exception so only update it on Windows
33+ if ( Platform . IsWindows )
34+ {
35+ // This sets the execution policy on Windows to Unrestricted which is required to run the user's function scripts on
36+ // Windows client versions. This is needed if a user is testing their function locally with the func CLI
37+ initialSessionState . ExecutionPolicy = Microsoft . PowerShell . ExecutionPolicy . Unrestricted ;
38+ }
3239 _pwsh = PowerShell . Create ( initialSessionState ) ;
3340 _logger = logger ;
3441
Original file line number Diff line number Diff line change 11{
2- "Description " :{
3- "Language " :" powershell" ,
4- "Extension" : " .ps1" ,
5- "DefaultExecutablePath " :" dotnet" ,
6- "DefaultWorkerPath " :" Azure.Functions.PowerShell.Worker.dll"
2+ "description " :{
3+ "language " :" powershell" ,
4+ "extensions" :[ " .ps1" ] ,
5+ "defaultExecutablePath " :" dotnet" ,
6+ "defaultWorkerPath " :" Azure.Functions.PowerShell.Worker.dll"
77 }
88}
You can’t perform that action at this time.
0 commit comments