Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7914c75

Browse files
author
Sergei Vorobev
committed
Fix bug in native pipe, where we loose End() output
1 parent 0ce50a8 commit 7914c75

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/System.Management.Automation/engine/NativeCommandProcessor.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,7 +1718,11 @@ internal void Add(object input)
17181718

17191719
private void AddTextInput(object input)
17201720
{
1721-
Array formattedObjects = _pipeline.Process(input);
1721+
AddTextInputFromFormattedArray(_pipeline.Process(input));
1722+
}
1723+
1724+
private void AddTextInputFromFormattedArray(Array formattedObjects)
1725+
{
17221726
foreach (var item in formattedObjects)
17231727
{
17241728
string line = PSObject.ToStringParser(_command.Context, item);
@@ -1821,7 +1825,7 @@ internal void Done()
18211825
// the calls are on the same thread, so there is no race condition.
18221826
if (_pipeline != null)
18231827
{
1824-
_pipeline.End();
1828+
AddTextInputFromFormattedArray(_pipeline.End());
18251829
_pipeline.Dispose();
18261830
_pipeline = null;
18271831
}

0 commit comments

Comments
 (0)