Skip to content

Commit

Permalink
(GH-8) Configuration for PowerShell Host
Browse files Browse the repository at this point in the history
By default use the internal PowerShell host. Allow using the system
host either by shutting off the feature or by using a switch
`--use-system-powershell`.
  • Loading branch information
ferventcoder committed Jan 1, 2016
1 parent fe779bf commit 2c298b6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/chocolatey/infrastructure.app/ApplicationParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public static class Features
public static readonly string FailOnAutoUninstaller = "failOnAutoUninstaller";
public static readonly string AllowGlobalConfirmation = "allowGlobalConfirmation";
public static readonly string FailOnStandardError = "failOnStandardError";
public static readonly string UsePowerShellHost = "powershellHost";
}

public static class Messages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ private static void set_feature_flags(ChocolateyConfiguration config, ConfigFile
config.Features.AutoUninstaller = set_feature_flag(ApplicationParameters.Features.AutoUninstaller, configFileSettings, defaultEnabled: true, description: "Uninstall from programs and features without requiring an explicit uninstall script.");
config.Features.FailOnAutoUninstaller = set_feature_flag(ApplicationParameters.Features.FailOnAutoUninstaller, configFileSettings, defaultEnabled: false, description: "Fail if automatic uninstaller fails.");
config.Features.FailOnStandardError = set_feature_flag(ApplicationParameters.Features.FailOnStandardError, configFileSettings, defaultEnabled: false, description: "Fail if install provider writes to stderr.");
config.Features.UsePowerShellHost = set_feature_flag(ApplicationParameters.Features.UsePowerShellHost, configFileSettings, defaultEnabled: true, description: "Use Chocolatey's built-in PowerShell host.");
config.PromptForConfirmation = !set_feature_flag(ApplicationParameters.Features.AllowGlobalConfirmation, configFileSettings, defaultEnabled: false, description: "Prompt for confirmation in scripts or bypass.");
}

Expand Down Expand Up @@ -264,6 +265,9 @@ private static void set_global_options(IList<string> args, ChocolateyConfigurati
.Add("failstderr|failonstderr|fail-on-stderr|fail-on-standard-error|fail-on-error-output",
"FailOnStandardError - Fail on standard error output (stderr), typically received when running external commands during install providers. This overrides the feature failOnStandardError.",
option => config.Features.FailOnStandardError = option != null)
.Add("use-system-powershell",
"UseSystemPowerShell - Execute PowerShell using an external process instead of the built-in PowerShell host.",
option => config.Features.UsePowerShellHost = option == null)
;
},
(unparsedArgs) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ public sealed class FeaturesConfiguration
public bool CheckSumFiles { get; set; }
public bool FailOnAutoUninstaller { get; set; }
public bool FailOnStandardError { get; set; }
public bool UsePowerShellHost { get; set; }
}

//todo: retrofit other command configs this way
Expand Down

0 comments on commit 2c298b6

Please sign in to comment.