Skip to content

Native error codes are masked in PowerShell pipelines on Unix-like platforms #8419

Closed

Description

On Unix-like platforms, with SIGPIPE signals being ignored, as in Ruby, writing to a broken pipe (a pipe whose reader process has since terminated) returns standard error code EPIPE.

However, it seems that in PowerShell - unlike in POSIX-like shells such as bash - the error code is not relayed to the writing process.

Steps to reproduce

Write 100,000 lines via Ruby, but cause the pipe to break via head -n 1 exiting after having received the 1st input line:

ruby -e '(1..1e5).each do |i| puts i end' | head -n 1

Expected behavior

1
-e:1:in `write': Broken pipe @ io_write - <STDOUT> (Errno::EPIPE)
	from -e:1:in `puts'
	from -e:1:in `puts'
	from -e:1:in `block in <main>'
	from -e:1:in `each'
	from -e:1:in `<main>'

Actual behavior

1

That is, the Ruby code never saw the EPIPE standard error code that results from writing to a broken pipe while SIGPIPE signals are being ignored.

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

Activity

  1. changed the title [-]Native error codes are masked in PowerShell pipelines[/-] [+]Native error codes are masked in PowerShell pipelines on Unix-like platforms[/+] on Dec 7, 2018
  2. iSazonov commented on Dec 8, 2018

    @iSazonov
    Collaborator

    For reference #2450

  3. iSazonov commented on Dec 8, 2018

    @iSazonov
    Collaborator

    Seems the issue could be fixed with #8420.

  4. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  5. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  6. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  7. microsoft-github-policy-service commented on Nov 23, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-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