Skip to content

Commit

Permalink
(chocolateyGH-316) Prevent reboots
Browse files Browse the repository at this point in the history
No matter what happens during the install/upgrade/uninstall, prevent the
system from rebooting.
  • Loading branch information
ferventcoder committed Jun 5, 2015
1 parent 21c7740 commit 767cc43
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -493,6 +495,9 @@ public ConcurrentDictionary<string, PackageResult> 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?)
Expand All @@ -504,7 +509,6 @@ public ConcurrentDictionary<string, PackageResult> uninstall_run(ChocolateyConfi
handle_unsuccessful_operation(config, packageResult, movePackageToFailureLocation: false, attemptRollback: false);
}

//todo:prevent reboots
});

var uninstallFailures = packageUninstalls.Count(p => !p.Value.Success);
Expand Down

0 comments on commit 767cc43

Please sign in to comment.