Skip to content

PowerShell commands run to completion even with a broken pipe to an external (native) program #8420

@mklement0

Description

@mklement0

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

1
1

Actual behavior

1
10

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-No ActivityIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions