Skip to content

Expose the destination subprocess methods on .pipe()#1252

Merged
sindresorhus merged 1 commit into
mainfrom
pipe-subprocess-methods
Jul 6, 2026
Merged

Expose the destination subprocess methods on .pipe()#1252
sindresorhus merged 1 commit into
mainfrom
pipe-subprocess-methods

Conversation

@sindresorhus

Copy link
Copy Markdown
Owner

The return value of subprocess.pipe() now forwards the destination subprocess' iteration (Symbol.asyncIterator, .iterable()), stream conversion (.all, .readable()) and IPC (.sendMessage(), .getOneMessage(), .getEachMessage()) methods, so the piped output can be consumed directly

.writable() and .duplex() are not forwarded, since they write to the destination's stdin, which is already piped from the source.

Fixes #1211

The return value of `subprocess.pipe()` now forwards the destination subprocess' iteration (`Symbol.asyncIterator`, `.iterable()`), stream conversion (`.all`, `.readable()`) and IPC (`.sendMessage()`, `.getOneMessage()`, `.getEachMessage()`) methods, so the piped output can be consumed directly.

`.writable()` and `.duplex()` are not forwarded, since they write to the destination's `stdin`, which is already piped from the source.

Fixes #1211
@sindresorhus sindresorhus merged commit c31c94c into main Jul 6, 2026
18 of 20 checks passed
@sindresorhus sindresorhus deleted the pipe-subprocess-methods branch July 6, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Progressive iteration over a piped process

1 participant