Skip to content

Commit

Permalink
Fix for stream termination
Browse files Browse the repository at this point in the history
  • Loading branch information
daveaglick committed Oct 1, 2018
1 parent c86605c commit e989c21
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
2 changes: 2 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# 1.1.1

- [Fix] Handles premature stream termination when reading events in the server

# 1.1.0

- [Feature] Support for server read cancellation with a `CancellationToken`
Expand Down
15 changes: 5 additions & 10 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ Task("Restore")
{
MSBuildSettings = msBuildSettings
});

// Run NuGet CLI restore to handle the Framework test projects
NuGetRestore($"./{projectName}.sln");
});

Task("Build")
Expand All @@ -106,7 +103,7 @@ Task("Build")
Task("Test")
.Description("Runs all tests.")
.IsDependentOn("Build")
.Does(() =>
.DoesForEach(GetFiles("./tests/*Tests/*.csproj"), project =>
{
DotNetCoreTestSettings testSettings = new DotNetCoreTestSettings()
{
Expand All @@ -123,12 +120,10 @@ Task("Test")
testSettings.TestAdapterPath = GetDirectories($"./tools/Appveyor.TestLogger.*/build/_common").First();
}

foreach (var project in GetFiles("./tests/*Tests/*.csproj"))
{
Information($"Running tests in {project}");
DotNetCoreTest(MakeAbsolute(project).ToString(), testSettings);
}
});
Information($"Running tests in {project}");
DotNetCoreTest(MakeAbsolute(project).ToString(), testSettings);
})
.DeferOnError();

Task("Pack")
.Description("Packs the NuGet packages.")
Expand Down
16 changes: 12 additions & 4 deletions src/MsBuildPipeLogger.Server/PipeLoggerServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,20 @@ public BuildEventArgs Read()
return null;
}

BuildEventArgs args = _buildEventArgsReader.Read();
if (args != null)
try
{
Dispatch(args);
return args;
BuildEventArgs args = _buildEventArgsReader.Read();
if (args != null)
{
Dispatch(args);
return args;
}
}
catch(EndOfStreamException)
{
// The stream may have been closed or otherwise stopped
}

return null;
}

Expand Down

0 comments on commit e989c21

Please sign in to comment.