Skip to content

Package Plugin should provide a convenient API for running subprocesses #5592

Open
@abertelrud

Description

@abertelrud

Description

It's very common to shell out to subprocesses from package plugins. In the initial version of the Package Plugin API we didn't want to duplication Foundation support for subprocesses, but it's become clear that there would be value in providing a much more ergonomic API than Foundation provides.

In particular, having API to invoke a subcommand and either return its output as a single string or possibly to invoke a closure for each line/chunk of output without having to set up output handlers and termination handlers etc would be very useful.

A side advantage could be to allow an IDE to provide information that the plugin is in fact running a subprocess, especially if that subprocess takes time to run.

Swift Package Manager version/commit hash

SwiftPM 5.7

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions