Clean up timeout reporting

This was sometimes reporting a null when the timeout takes place. We
need to throw with a timeout for real
This commit is contained in:
Ryan Nowak 2018-09-13 15:40:37 -07:00
parent f93f67a53a
commit 1e8e541f65
1 changed files with 4 additions and 7 deletions

View File

@ -60,7 +60,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
process.BeginErrorReadLine();
process.BeginOutputReadLine();
var timeoutTask = Task.Delay(timeout.Value).ContinueWith((t) =>
var timeoutTask = Task.Delay(timeout.Value).ContinueWith<MSBuildResult>((t) =>
{
// Don't timeout during debug sessions
while (Debugger.IsAttached)
@ -68,15 +68,12 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Thread.Sleep(TimeSpan.FromSeconds(1));
}
if (process.HasExited)
if (!process.HasExited)
{
// This will happen on success, the 'real' task has already completed so this value will
// never be visible.
return (MSBuildResult)null;
// This is a timeout.
process.Kill();
}
// This is a timeout.
process.Kill();
throw new TimeoutException($"command '${process.StartInfo.FileName} {process.StartInfo.Arguments}' timed out after {timeout}. Output: {output.ToString()}");
});