Note: The issue isn't specific to Unix, as originally stated - see #15329
... | Select-Object -First 1 stops the upstream command after receiving the 1st input object, but the same is not true when the sink is an external program:
Steps to reproduce
1..10 | Write-Output -ov result | head -n 1; $result.Count
Expected behavior
Actual behavior
That is, Write-Output unexpectedly ran to completion, even though head exited after receiving the first input line, making it pointless to send additional objects to the pipeline.
Environment data
PowerShell Core v6.2.0-preview.2 on macOS 10.14.1
PowerShell Core v6.2.0-preview.2 on Ubuntu 18.04.1 LTS
Note: The issue isn't specific to Unix, as originally stated - see #15329
... | Select-Object -First 1stops the upstream command after receiving the 1st input object, but the same is not true when the sink is an external program:Steps to reproduce
Expected behavior
Actual behavior
That is,
Write-Outputunexpectedly ran to completion, even thoughheadexited after receiving the first input line, making it pointless to send additional objects to the pipeline.Environment data