Skip to content

Windows pipes: one implementation of the pipe-room/peek P/Invokes; read_nonblock's PeekNamedPipe fallback is mostly dead #145

Closed

Description

@Largo

After #116 and #119, Windows pipe readiness lives in two places:

  • Src/Ruby/Builtins/WindowsPipeStream.cs declares NtQueryInformationFile / FILE_PIPE_LOCAL_INFORMATION (WriteQuotaAvailable(), IsReaderGone()) and PeekNamedPipe.
  • Src/Libraries/Builtins/IoReadiness.cs declares the same again (GetWindowsPipeRoom, IsWindowsPipeWritable, IsWindowsPipeReadable), used by IO.select.

The two differ slightly. GetWindowsPipeRoom returns Int32.MaxValue when the reader is gone; WindowsPipeStream asks IsReaderGone() separately.

IoOps.ReadOnceWithoutWaiting also has a Windows-pipe PeekNamedPipe fallback for read_nonblock, added in #119. Since #116, IO.pipe and popen pipes are WindowsPipeStreams, which implement INonBlockingReadStream and take the path before that fallback. The fallback now only matters for a pipe that reaches an IO some other way (an inherited handle wrapped by IO.for_fd?), if that happens at all.

Suggested cleanup: keep one implementation (WindowsPipeStream's, made internal static helpers on it or a small WindowsPipe class), have IoReadiness call it, and either drop the read_nonblock fallback or document what still reaches it. No behaviour change. Io_Timeout2, WeakMap_NoBlock1, Windows_PipeBlocking1, Windows_StdoutPipeSysWrite1 and ruby/spec core/io on Windows are the checks.

Activity

  1. added a commit that references this issue on Nov 8, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions