From 738f036446fbcaee2255983e6851023ab494da88 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Mon, 11 Mar 2019 13:23:38 -0500 Subject: [PATCH] (GH-1747) Fix: passing timeout switch of 0 is ignored 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. --- .../infrastructure.app/builders/ConfigurationBuilder.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs index 459ff92494..59a9e3ec3b 100644 --- a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs +++ b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs @@ -379,8 +379,9 @@ private static void set_global_options(IList 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; }