diff --git a/src/chocolatey/infrastructure.app/ApplicationParameters.cs b/src/chocolatey/infrastructure.app/ApplicationParameters.cs index f5e22c73de..2435440b31 100644 --- a/src/chocolatey/infrastructure.app/ApplicationParameters.cs +++ b/src/chocolatey/infrastructure.app/ApplicationParameters.cs @@ -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 diff --git a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs index 1bb651152c..8ea8a8fadc 100644 --- a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs +++ b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs @@ -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."); } @@ -264,6 +265,9 @@ private static void set_global_options(IList 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) => diff --git a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs index b1cc843e9c..495c70ce95 100644 --- a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs +++ b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs @@ -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