diff --git a/src/chocolatey/infrastructure.app/ApplicationParameters.cs b/src/chocolatey/infrastructure.app/ApplicationParameters.cs index cf0f2e882c..8a39f7606a 100644 --- a/src/chocolatey/infrastructure.app/ApplicationParameters.cs +++ b/src/chocolatey/infrastructure.app/ApplicationParameters.cs @@ -122,6 +122,7 @@ public static class Environment public static readonly string ChocolateyCheckLastExitCode = "ChocolateyCheckLastExitCode"; public static readonly string ChocolateyPowerShellHost = "ChocolateyPowerShellHost"; public static readonly string ChocolateyForce = "ChocolateyForce"; + public static readonly string ChocolateyExitOnRebootDetected = "ChocolateyExitOnRebootDetected"; } /// diff --git a/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs b/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs index 6d0d4e3731..e825ac0476 100644 --- a/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs +++ b/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs @@ -56,6 +56,7 @@ public static void reset_environment_variables(ChocolateyConfiguration config) Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyAllowEmptyChecksumsSecure, null); Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyPowerShellHost, null); Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyForce, null); + Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyExitOnRebootDetected, null); Environment.SetEnvironmentVariable("chocolateyProxyLocation", null); Environment.SetEnvironmentVariable("chocolateyProxyBypassList", null); @@ -127,6 +128,7 @@ public static void set_environment_variables(ChocolateyConfiguration config) if (config.Features.UsePowerShellHost) Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyPowerShellHost, "true"); if (config.Force) Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyForce, "true"); + if (config.Features.ExitOnRebootDetected) Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyExitOnRebootDetected, "true"); set_licensed_environment(config); } diff --git a/src/chocolatey/infrastructure.app/templates/ChocolateyReadMeTemplate.cs b/src/chocolatey/infrastructure.app/templates/ChocolateyReadMeTemplate.cs index e5d9df2ee5..fd3e36fffd 100644 --- a/src/chocolatey/infrastructure.app/templates/ChocolateyReadMeTemplate.cs +++ b/src/chocolatey/infrastructure.app/templates/ChocolateyReadMeTemplate.cs @@ -108,6 +108,7 @@ Chocolatey makes a number of environment variables available (You can access any * ChocolateyEnvironmentDebug - Was `--debug` passed? If using the built-in PowerShell host, this is always true (but only logs debug messages to console if `--debug` was passed) (0.9.10+) * ChocolateyEnvironmentVerbose - Was `--verbose` passed? If using the built-in PowerShell host, this is always true (but only logs verbose messages to console if `--verbose` was passed). (0.9.10+) + * ChocolateyExitOnRebootDetected - Are we exiting on a detected reboot? Set by ` --exit-when-reboot-detected` or the feature `exitOnRebootDetected` (0.10.16+) * ChocolateyForce - Was `--force` passed? (0.9.10+) * ChocolateyForceX86 - Was `-x86` passed? (CHECK) * ChocolateyRequestTimeout - How long before a web request will time out. Set by config `webRequestTimeoutSeconds` (CHECK)