feat: add ProcessPromise.unpipe()#1302
Conversation
antongolub
commented
Aug 1, 2025
- Tests pass
- Appropriate changes to README are included in PR
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new unpipe() method to the ProcessPromise class, allowing developers to remove processes from existing pipelines during execution. This complements the existing pipe() functionality by providing a way to dynamically control data flow between processes.
- Adds
ProcessPromise.unpipe()method for removing processes from pipelines - Refactors piping implementation to support dynamic unpipe operations
- Updates type definitions to include a
run()method on promisified streams
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/core.ts | Core implementation of unpipe() method and refactored piping logic |
| test/core.test.js | Test coverage for the new unpipe() functionality |
| test/export.test.js | Export validation tests for new static method |
| test-d/core.test-d.ts | TypeScript type definition updates for promisified streams |
| docs/process-promise.md | Documentation and usage examples for unpipe() |
| src/util.ts | Minor type annotation cleanup |
| build/core.cjs | Compiled JavaScript output |
| .size-limit.json | Updated bundle size limits |
| }, 150) | ||
|
|
||
| const { stdout } = await p3 | ||
| assert.equal(stdout, 'foo\n1\nbar\n2\n3\n') |
There was a problem hiding this comment.
There's a typo in the expected output string. It should be '3\n' instead of '3' to match the documented example.
| assert.equal(stdout, 'foo\n1\nbar\n2\n3\n') | |
| assert.equal(stdout, 'foo\n1\nbar\n2\n3\n\n') |
|
|
||
| assert.equal((await p1).stdout, 'foo\nbar\nbaz\nqux') | ||
| assert.equal((await p2).stdout, '1\n2\n3') | ||
| assert.equal((await p3).stdout, 'foo\n1\nbar\n2\n3') |
There was a problem hiding this comment.
The expected output is missing the final newline character. Based on the test implementation, it should be 'foo\n1\nbar\n2\n3\n' to match the actual behavior.
| assert.equal((await p3).stdout, 'foo\n1\nbar\n2\n3') | |
| assert.equal((await p3).stdout, 'foo\n1\nbar\n2\n3\n') |