swiftlang / swiftlang/swift-subprocess

[Feature] Support for synchronous use.

Open
#207 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Swift
Stars
734
Forks
68
Avg merge
9d 2h
Merged PRs (30d)
6

Description

I learned recently if you Foundation.Process.waitUntilExit without first draining the standard output and error streams the system can deadlock, because it refuses to allow more data to be streamed out of the child process when its output buffers become full. I don't see any code for handling that situation here.
Here's an example of how it's done. The number of examples of doing this wrong out there are astounding. I know the new hotness is to await everything but I have synchronous code that really does need to block until another process completes, and I'd rather use an off-the-shelf package than repeat my own code. It would be great if this package could provide an answer for these situations, but I don't see one.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the package's existing process-spawning and stream-handling APIs, then compare them with the linked ProcessUtilities.swift example. Define the synchronous use case around Foundation.Process.waitUntilExit and verify that stdout and stderr are drained without deadlock. Done means callers can block until completion while safely consuming both output streams.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.