Skip to content

Commit

Permalink
(GH-1747) Fix: passing timeout switch of 0 is ignored
Browse files Browse the repository at this point in the history
Passing the execution timeout of 0 is ignored and the default value is
used. It appears this situation was not explicitly being looked for as
zero is typically the return value when parsing and not getting a value
back. Look specifically if the user-provided string was zero and use
that to set infinite runtime.
  • Loading branch information
ferventcoder committed Mar 11, 2019
1 parent 295606e commit 738f036
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,9 @@ private static void set_global_options(IList<string> args, ChocolateyConfigurati
option =>
{
int timeout = 0;
int.TryParse(option.remove_surrounding_quotes(), out timeout);
if (timeout > 0)
var timeoutString = option.remove_surrounding_quotes();
int.TryParse(timeoutString, out timeout);
if (timeout > 0 || timeoutString.is_equal_to("0"))
{
config.CommandExecutionTimeoutSeconds = timeout;
}
Expand Down

0 comments on commit 738f036

Please sign in to comment.