ssg: StaticSiteClient: command timeout

This commit is contained in:
Nick Vella 2019-07-19 01:48:06 +10:00
parent 1c7c774795
commit a09c738141
1 changed files with 7 additions and 1 deletions

View File

@ -383,7 +383,13 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
proc.BeginOutputReadLine(); proc.BeginOutputReadLine();
proc.BeginErrorReadLine(); proc.BeginErrorReadLine();
} }
proc.WaitForExit();
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
outStdout = stdout; outStdout = stdout;