Skip to content

Commit

Permalink
(chocolateyGH-689) Report install work w/non-POSH pkgs
Browse files Browse the repository at this point in the history
If a package is a dependency or has no PowerShell, it should still
clean up env vars between the two packages.
  • Loading branch information
ferventcoder committed May 31, 2016
1 parent f6e5c1d commit e584f0f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,15 @@ private static void set_environment_options(ChocolateyConfiguration config)
config.Information.IsProcessElevated = ProcessInformation.process_is_elevated();
}

public static void set_environment_variables(ChocolateyConfiguration config)
public static void reset_environment_variables(ChocolateyConfiguration config)
{
Environment.SetEnvironmentVariable("ChocolateyPackageInstallLocation", null);
Environment.SetEnvironmentVariable("ChocolateyInstallerType", null);
}

public static void set_environment_variables(ChocolateyConfiguration config)
{
reset_environment_variables(config);

Environment.SetEnvironmentVariable(ApplicationParameters.ChocolateyInstallEnvironmentVariableName, ApplicationParameters.InstallLocation);
Environment.SetEnvironmentVariable("CHOCOLATEY_VERSION", config.Information.ChocolateyVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace chocolatey.infrastructure.app.services
using System.Collections.Generic;
using System.IO;
using System.Linq;
using builders;
using commandline;
using configuration;
using domain;
Expand Down Expand Up @@ -271,6 +272,7 @@ public void randomly_notify_about_pro_business(ChocolateyConfiguration config, s

public void handle_package_result(PackageResult packageResult, ChocolateyConfiguration config, CommandNameType commandName)
{
ConfigurationBuilder.reset_environment_variables(config);
set_pending(packageResult, config);
var pkgInfo = _packageInfoService.get_package_information(packageResult.Package);
if (config.AllowMultipleVersions)
Expand Down

0 comments on commit e584f0f

Please sign in to comment.