swiftlang / swiftlang/swift-subprocess

[Feature] How do you pipe?

Open
#151 3 comments 1 reaction 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'm trying the library out and essentially my question is how to execute the equivalent of the following:

grep 'text' . | wc -l

using this library without manually collecting the output of each step.

The run function signature only appears to accept one subprogram name as an argument to launch a single process (which is understandable).

The current outputs/inputs are types like String or Data, so it's not immediately clear how to 'pipe' the output of one subprocess to another, without resorting to doing it manually via an intermediate String or something.
I suppose all the shells on all supported platforms support piping so there could be a way to simplify this common task? (or maybe there already is?)

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 reading the run function signature and the existing String and Data process input/output types. Trace how one subprocess is launched and how its output is consumed. Done means the library supports a grep-to-wc-style pipeline without manually collecting an intermediate result.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.