Skip to content

Commit

Permalink
Fix for issue 1059.
Browse files Browse the repository at this point in the history
commandExecutionTimeoutSeconds was defined twice in the Chocolatey
configuration. With this pull request, only the primary key is used. This
fixes the incorrect behaviour that choco exhibited when changing this
value through `choco config`.

Closes chocolatey#1059 chocolatey#973 .
  • Loading branch information
Alex van den Hoogen committed Jan 27, 2017
1 parent 1c0ca10 commit b37f1fc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
1 change: 0 additions & 1 deletion src/chocolatey/infrastructure.app/ApplicationParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ public static class ConfigSettings
{
public static readonly string CacheLocation = "cacheLocation";
public static readonly string ContainsLegacyPackageInstalls = "containsLegacyPackageInstalls";
public static readonly string CommandExecutionTimeoutSeconds = "commandExecutionTimeoutSeconds";
public static readonly string Proxy = "proxy";
public static readonly string ProxyUser = "proxyUser";
public static readonly string ProxyPassword = "proxyPassword";
Expand Down
20 changes: 6 additions & 14 deletions src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,21 +194,13 @@ private static void set_config_items(ChocolateyConfiguration config, ConfigFileS
config.CacheLocation = fileSystem.combine_paths(ApplicationParameters.InstallLocation, "temp");
}

var originalCommandTimeout = configFileSettings.CommandExecutionTimeoutSeconds;
var commandExecutionTimeoutSeconds = -1;
int.TryParse(
set_config_item(
ApplicationParameters.ConfigSettings.CommandExecutionTimeoutSeconds,
configFileSettings,
originalCommandTimeout == 0 ?
ApplicationParameters.DefaultWaitForExitInSeconds.to_string()
: originalCommandTimeout.to_string(),
"Default timeout for command execution."),
out commandExecutionTimeoutSeconds);
config.CommandExecutionTimeoutSeconds = commandExecutionTimeoutSeconds;
if (configFileSettings.CommandExecutionTimeoutSeconds <= 0)
if (configFileSettings.CommandExecutionTimeoutSeconds > 0)
{
config.CommandExecutionTimeoutSeconds = configFileSettings.CommandExecutionTimeoutSeconds;
}
else
{
set_config_item(ApplicationParameters.ConfigSettings.CommandExecutionTimeoutSeconds, configFileSettings, ApplicationParameters.DefaultWaitForExitInSeconds.to_string(), "Default timeout for command execution.", forceSettingValue: true);
set_config_item(ApplicationParameters.DefaultWaitForExitInSeconds.to_string(), configFileSettings, ApplicationParameters.DefaultWaitForExitInSeconds.to_string(), "Default timeout for command execution.", forceSettingValue: true);
config.CommandExecutionTimeoutSeconds = ApplicationParameters.DefaultWaitForExitInSeconds;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<config>
<add key="cacheLocation" value="" />
<add key="containsLegacyPackageInstalls" value="true" />
<add key="commandExecutionTimeoutSeconds" value="2700" />
<add key="proxy" value="" />
<add key="proxyUser" value="" />
<add key="proxyPassword" value="" />
Expand Down

0 comments on commit b37f1fc

Please sign in to comment.