You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are now parameters and a feature flag which will allow
halting/overriding the install/upgrade/uninstall of a package, when
a reboot request is returned from one of it's dependencies.
When this occurs, an ApplicationException will be thrown, along with
a specific exit code, either 350 (pending reboot discovered prior to
running), or 1604 (some work completed prior to restart request) will be
returned. This could then be inspected to decide when a reboot should
actually be performed, before continuing with the remainder of the
installation.
The initial implementation of this ability followed closely to how the
stoponfirstfailure parameter and feature flag are implemented, and then
subsequent changes added to the implementation.
config.Features.ScriptsCheckLastExitCode=set_feature_flag(ApplicationParameters.Features.ScriptsCheckLastExitCode,configFileSettings,defaultEnabled:false,description:"Scripts Check $LastExitCode (external commands) - Leave this off unless you absolutely need it while you fix your package scripts to use `throw 'error message'` or `Set-PowerShellExitCode #` instead of `exit #`. This behavior started in 0.9.10 and produced hard to find bugs. If the last external process exits successfully but with an exit code of not zero, this could cause hard to detect package failures. Available in 0.10.3+. Will be removed in 0.11.0.");
305
305
config.PromptForConfirmation=!set_feature_flag(ApplicationParameters.Features.AllowGlobalConfirmation,configFileSettings,defaultEnabled:false,description:"Prompt for confirmation in scripts or bypass.");
306
+
config.Features.ExitOnRebootDetected=set_feature_flag(ApplicationParameters.Features.ExitOnRebootDetected,configFileSettings,defaultEnabled:false,description:"Exit On Reboot Detected - Stop running install, upgrade, or uninstall when a reboot request is detected. Requires '{0}' feature to be turned on. Will exit with either {1} or {2}. When it exits with {1}, it means pending reboot discovered prior to running operation. When it exits with {2}, it means some work completed prior to reboot request being detected. As this will affect upgrade all, it is normally recommended to leave this off. Available in 0.10.12+.".format_with(ApplicationParameters.Features.ExitOnRebootDetected,ApplicationParameters.ExitCodes.ErrorFailNoActionReboot,ApplicationParameters.ExitCodes.ErrorInstallSuspend));
Copy file name to clipboardexpand all lines: src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs
+15
Original file line number
Diff line number
Diff line change
@@ -155,6 +155,21 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon
155
155
"Stop On First Package Failure - stop running install, upgrade or uninstall on first package failure instead of continuing with others. Overrides the default feature '{0}' set to '{1}'. Available in 0.10.4+.".format_with(ApplicationParameters.Features.StopOnFirstPackageFailure,configuration.Features.StopOnFirstPackageFailure.to_string()),
"Exit When Reboot Detected - Stop running install, upgrade, or uninstall when a reboot request is detected. Requires '{0}' feature to be turned on. Will exit with either {1} or {2}. Overrides the default feature '{3}' set to '{4}'. Available in 0.10.12+.".format_with
"Ignore Detected Reboot - If a reboot request is detected during a Chocolatey operation, then ignore it. Overrides the default feature '{0}' set to '{1}'. Available in 0.10.12+.".format_with
Copy file name to clipboardexpand all lines: src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs
+15
Original file line number
Diff line number
Diff line change
@@ -118,6 +118,21 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon
118
118
"Stop On First Package Failure - stop running install, upgrade or uninstall on first package failure instead of continuing with others. Overrides the default feature '{0}' set to '{1}'. Available in 0.10.4+.".format_with(ApplicationParameters.Features.StopOnFirstPackageFailure,configuration.Features.StopOnFirstPackageFailure.to_string()),
"Exit When Reboot Detected - Stop running install, upgrade, or uninstall when a reboot request is detected. Requires '{0}' feature to be turned on. Will exit with either {1} or {2}. Overrides the default feature '{3}' set to '{4}'. Available in 0.10.12+.".format_with
"Ignore Detected Reboot - If a reboot request is detected during a Chocolatey operation, then ignore it. Overrides the default feature '{0}' set to '{1}'. Available in 0.10.12+.".format_with
"Exit When Reboot Detected - Stop running install, upgrade, or uninstall when a reboot request is detected. Requires '{0}' feature to be turned on. Will exit with either {1} or {2}. Overrides the default feature '{3}' set to '{4}'. Available in 0.10.12+.".format_with
"Ignore Detected Reboot - If a reboot request is detected during a Chocolatey operation, then ignore it. Overrides the default feature '{0}' set to '{1}'. Available in 0.10.12+.".format_with
0 commit comments