Skip to content

Commit

Permalink
(GH-304) Auto Installer allow system cleanup
Browse files Browse the repository at this point in the history
If the preceeding chocolatelyUninstall.ps1 uninstalls an application,
sometimes the system is still cleaning up files and registry keys.
Those keys are found by the auto installer and it decides to also move
forward with the uninstall. In cases like that, the auto uninstaller
should wait a few seconds before moving forward with checks.
  • Loading branch information
ferventcoder committed Jun 4, 2015
1 parent dfabcc3 commit b82436b
Showing 1 changed file with 4 additions and 0 deletions.
Expand Up @@ -18,6 +18,7 @@ namespace chocolatey.infrastructure.app.services
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using configuration;
using domain;
using filesystem;
Expand All @@ -30,6 +31,7 @@ public class AutomaticUninstallerService : IAutomaticUninstallerService
private readonly IFileSystem _fileSystem;
private readonly IRegistryService _registryService;
private readonly ICommandExecutor _commandExecutor;
private const int SLEEP_TIME = 5;

public AutomaticUninstallerService(IChocolateyPackageInformationService packageInfoService, IFileSystem fileSystem, IRegistryService registryService, ICommandExecutor commandExecutor)
{
Expand Down Expand Up @@ -63,6 +65,8 @@ public void run(PackageResult packageResult, ChocolateyConfiguration config)
}

this.Log().Info(" Running auto uninstaller...");
this.Log().Debug("Sleeping for {0} seconds to allow Windows to finish cleaning up.".format_with(SLEEP_TIME));
Thread.Sleep((int)TimeSpan.FromSeconds(SLEEP_TIME).TotalMilliseconds);

foreach (var key in registryKeys.or_empty_list_if_null())
{
Expand Down

0 comments on commit b82436b

Please sign in to comment.