Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update configs for beta36 of core tools and add windows if check #23

Merged
merged 2 commits into from
Sep 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/PSCoreApp/host.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"version": "2.0",
"logger": {
"categoryFilter": {
"defaultLevel": "Trace",
Expand Down
9 changes: 8 additions & 1 deletion src/PowerShell/PowerShellManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ internal class PowerShellManager
internal PowerShellManager(RpcLogger logger)
{
var initialSessionState = InitialSessionState.CreateDefault();
initialSessionState.ExecutionPolicy = Microsoft.PowerShell.ExecutionPolicy.Unrestricted;

// Setting the execution policy on macOS and Linux throws an exception so only update it on Windows
if(Platform.IsWindows)
{
// This sets the execution policy on Windows to Unrestricted which is required to run the user's function scripts on
// Windows client versions. This is needed if a user is testing their function locally with the func CLI
initialSessionState.ExecutionPolicy = Microsoft.PowerShell.ExecutionPolicy.Unrestricted;
}
_pwsh = PowerShell.Create(initialSessionState);
_logger = logger;

Expand Down
10 changes: 5 additions & 5 deletions src/worker.config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"Description":{
"Language":"powershell",
"Extension":".ps1",
"DefaultExecutablePath":"dotnet",
"DefaultWorkerPath":"Azure.Functions.PowerShell.Worker.dll"
"description":{
"language":"powershell",
"extensions":[".ps1"],
"defaultExecutablePath":"dotnet",
"defaultWorkerPath":"Azure.Functions.PowerShell.Worker.dll"
}
}