diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs index 2cddc469d6..e6337dabdf 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs @@ -23,6 +23,7 @@ namespace chocolatey.infrastructure.app.services using configuration; using domain; using filesystem; + using infrastructure.commands; using infrastructure.services; using logging; using platforms; @@ -173,7 +174,8 @@ public void handle_package_result(PackageResult packageResult, ChocolateyConfigu var powerShellRan = _powershellService.install(config, packageResult); if (powerShellRan) { - //todo: prevent reboots + // we don't care about the exit code + if (config.Information.PlatformType == PlatformType.Windows) CommandExecutor.execute("shutdown", "/a", config.CommandExecutionTimeoutSeconds, _fileSystem.get_current_directory(), (s, e) => { }, (s, e) => { }, false); } var difference = _registryService.get_differences(before, _registryService.get_installer_keys()); @@ -493,6 +495,9 @@ public ConcurrentDictionary uninstall_run(ChocolateyConfi _autoUninstallerService.run(packageResult, config); + // we don't care about the exit code + if (config.Information.PlatformType == PlatformType.Windows) CommandExecutor.execute("shutdown", "/a", config.CommandExecutionTimeoutSeconds, _fileSystem.get_current_directory(), (s, e) => { }, (s, e) => { }, false); + if (packageResult.Success) { //todo: v2 clean up package information store for things no longer installed (call it compact?) @@ -504,7 +509,6 @@ public ConcurrentDictionary uninstall_run(ChocolateyConfi handle_unsuccessful_operation(config, packageResult, movePackageToFailureLocation: false, attemptRollback: false); } - //todo:prevent reboots }); var uninstallFailures = packageUninstalls.Count(p => !p.Value.Success);