ssg: StaticSiteClient: allow for disabled timeouts

This commit is contained in:
Nick Vella 2019-07-31 20:51:35 +10:00
parent 8143dcf231
commit e28f2e64c4
1 changed files with 11 additions and 4 deletions

View File

@ -519,11 +519,18 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
proc.BeginErrorReadLine(); proc.BeginErrorReadLine();
} }
if (!proc.WaitForExit(Config.CmdTimeoutMs)) if(Config.CmdTimeoutMs < 0)
{ {
// Timeout reached // If timeout is negative, timeout is disabled.
try { proc.Kill(); } catch { } // Attempt to kill the process proc.WaitForExit();
throw new BlogClientException("Command execution timeout", "Blog command timed out. Please check your commands, or lengthen the command timeout."); // TODO move into strings } else
{
if (!proc.WaitForExit(Config.CmdTimeoutMs))
{
// Timeout reached
try { proc.Kill(); } catch { } // Attempt to kill the process
throw new BlogClientException("Command execution timeout", "Blog command timed out. Please check your commands, or lengthen the command timeout."); // TODO move into strings
}
} }
// The caller will have all output waiting in outStdout and outStderr // The caller will have all output waiting in outStdout and outStderr