Call 'DoComplete' when handling FileRedirection for CommandExpression#4847
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix#4812
Summary
When handling file redirection for CommandExpression, we don't call 'DoComplete' on the underlying
PipelineProcessorof theFileRedirectionobject, and thus theEndProcessingmethod is not called onOut-File, which causes different behaviors between<expr> > out.txtand<expr> | Out-File out.txt.The fix is to make sure 'DoComplete' is called after the stream output has been written to the redirection pipe.
Also fix another issue
This PR also fixes an issue that could mess up restoring the original pipes. Here is the repro:
The root cause is that we don't always restore pipes in the correct order. Please see the code changes in
Compiler.csfor more details./cc @mklement0