mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Make AngularCliBuilder provide better information about timeouts
This commit is contained in:
@@ -39,7 +39,7 @@ namespace Microsoft.AspNetCore.SpaServices.AngularCli
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task Build(ISpaBuilder spaBuilder)
|
public async Task Build(ISpaBuilder spaBuilder)
|
||||||
{
|
{
|
||||||
var sourcePath = spaBuilder.Options.SourcePath;
|
var sourcePath = spaBuilder.Options.SourcePath;
|
||||||
if (string.IsNullOrEmpty(sourcePath))
|
if (string.IsNullOrEmpty(sourcePath))
|
||||||
@@ -57,18 +57,27 @@ namespace Microsoft.AspNetCore.SpaServices.AngularCli
|
|||||||
null);
|
null);
|
||||||
npmScriptRunner.AttachToLogger(logger);
|
npmScriptRunner.AttachToLogger(logger);
|
||||||
|
|
||||||
|
using (var stdOutReader = new EventedStreamStringReader(npmScriptRunner.StdOut))
|
||||||
using (var stdErrReader = new EventedStreamStringReader(npmScriptRunner.StdErr))
|
using (var stdErrReader = new EventedStreamStringReader(npmScriptRunner.StdErr))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return npmScriptRunner.StdOut.WaitForMatch(
|
await npmScriptRunner.StdOut.WaitForMatch(
|
||||||
new Regex("chunk", RegexOptions.None, RegexMatchTimeout),
|
new Regex("Date", RegexOptions.None, RegexMatchTimeout),
|
||||||
BuildTimeout);
|
BuildTimeout);
|
||||||
}
|
}
|
||||||
catch (EndOfStreamException ex)
|
catch (EndOfStreamException ex)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException(
|
throw new InvalidOperationException(
|
||||||
$"The NPM script '{_npmScriptName}' exited without indicating success. " +
|
$"The NPM script '{_npmScriptName}' exited without indicating success.\n" +
|
||||||
|
$"Output was: {stdOutReader.ReadAsString()}\n" +
|
||||||
|
$"Error output was: {stdErrReader.ReadAsString()}", ex);
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException ex)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException(
|
||||||
|
$"The NPM script '{_npmScriptName}' timed out without indicating success. " +
|
||||||
|
$"Output was: {stdOutReader.ReadAsString()}\n" +
|
||||||
$"Error output was: {stdErrReader.ReadAsString()}", ex);
|
$"Error output was: {stdErrReader.ReadAsString()}", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user