Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle STDOUT more correctly #8840

Merged
merged 3 commits into from Jan 19, 2024
Merged

Handle STDOUT more correctly #8840

merged 3 commits into from Jan 19, 2024

Conversation

ryanbrandenburg
Copy link
Contributor

There are cases where we are failing to look at the entire result of a ProcessExtensions call because we return our result as soon as process.Exited is Invoked. But process.Exited does not indicate that all the STDOUT and STDERR events have been handled, only that the process has entered the Exited state. So I took a look at what they do in dotnet/format and made some changes. Of particular note here is the call to WaitForExit which guarantees that all events currently in-flight returns before returning.

This could express itself in a lot of ways, but what I observed was that not all transitive dependencies of a project were being correctly reported (we shell that work out to MSBuild). I was unable to write a unit-test which replicated that behavior (unsurprising since it's technically a timing issue), but did find that my changes fixed local runs which were exhibiting this behavior. If anyone can come up with a Unit Test of ProcessExtensions.RunAsync which could reliably test this I'm all ear, otherwise I think we'll have to rely on the practical test I did and the fact that we're cribbing off of dotnet/format and roslyn.

Huge thanks to @JoeRobich for pairing with me on this one.

@ryanbrandenburg ryanbrandenburg requested a review from a team as a code owner January 18, 2024 19:08
@github-actions github-actions bot added the L: dotnet:nuget NuGet packages via nuget or dotnet label Jan 18, 2024
Copy link
Collaborator

@JoeRobich JoeRobich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a good discovery.

@jakecoffman jakecoffman merged commit c1ad8c6 into main Jan 19, 2024
63 checks passed
@jakecoffman jakecoffman deleted the dev/rybrande/STDOUTComplete branch January 19, 2024 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: dotnet:nuget NuGet packages via nuget or dotnet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants