Conversation
…child process is keeping the MSBuild waiting
rainersigwald
left a comment
There was a problem hiding this comment.
Remember how you mentioned this offline and said "I bet Rainer will ask for {some wise thing to ask}"?
. . . let's assume I ask for that :-P
(Was it a wait-for-flush situation? I don't know if there's a great way to do that. Maybe just putting this behind a changewave would be sufficient?)
Co-authored-by: Rainer Sigwald <raines@microsoft.com>
|
I remember that when I analyzed the problem, the issue of WaitForExit(int) is that it doesn't wait for the pipes to empty. I'm not sure, but I think it can lead to the end of the output to be truncated. |
I think I'm running into this issue after this PR: #10378 |
|
There could be a work around using some reflection hack, but without that there is no way to wait for exit cleanly on windows. Ideally the underlying bug should be fixed: dotnet/runtime#51277 |
Fixes #2981
and probably #10286
Context
ToolTaskcan hang when child process spawns a grandchild process that doesn't exit.Changes Made
Using different overload of
WaitForExitto avoid situation when grandchild process is keeping the MSBuild waiting.See dotnet/runtime#51277 and #2981 (comment)
Testing
Manual testing with custom
ToolTaskimplementation. This tasks starts process that starts another process with longer lifetime.Notes