-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: add ProcessPromise.unpipe()
#1302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
antongolub
commented
Aug 1, 2025
- Tests pass
- Appropriate changes to README are included in PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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') |
Copilot
AI
Aug 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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') |
Copilot
AI
Aug 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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') |