Skip to content

NFC: Add AsyncStream-based API to AsyncProcess #7830

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

Merged
merged 10 commits into from
Aug 7, 2024

Conversation

MaxDesiatov
Copy link
Contributor

@MaxDesiatov MaxDesiatov commented Jul 26, 2024

Existing AsyncProcess closure-based API for stdout and stderr consumption requires a lot of tedious and error-prone ceremony for use of async. One needs to manually create AsyncStreams and their continuations, feed the output via the continuations, spawn a task group and consume the output in separate tasks, while launching the process at the same time.

We should provide a simpler popen-like API that allows passing async closures that receive ready for iteration AsyncStreams as arguments.

No functional change is made in this PR, the new API is not used yet outside of corresponding tests.

Base automatically changed from maxd/async-process-tests to main July 26, 2024 16:39
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test

@MaxDesiatov MaxDesiatov marked this pull request as ready for review July 28, 2024 12:51
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci test windows

@MaxDesiatov MaxDesiatov enabled auto-merge (squash) July 28, 2024 12:51
@MaxDesiatov MaxDesiatov added no functional change No user-visible functional changes included and removed needs tests This change needs test coverage needs documentation labels Jul 28, 2024
@MaxDesiatov MaxDesiatov changed the title Add AsyncStream-based API to AsyncProcess NFC: Add AsyncStream-based API to AsyncProcess Jul 28, 2024
@MaxDesiatov MaxDesiatov self-assigned this Jul 28, 2024
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test windows

@xedin
Copy link
Contributor

xedin commented Aug 6, 2024

@swift-ci please test

@MaxDesiatov MaxDesiatov merged commit 566b4e1 into main Aug 7, 2024
5 checks passed
@MaxDesiatov MaxDesiatov deleted the maxd/async-process-stream branch August 7, 2024 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
concurrency no functional change No user-visible functional changes included
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants