Add swift-subprocess dependency

Foundation.Process cannot call setsid() between fork and exec, which a
controlling-terminal pty requires. Subprocess exposes it as
PlatformOptions.createSession, alongside the file-descriptor hand-off and
process-group teardown the pty path needs.

Pinned exactly at 1.0.0 per CONVENTIONS.md; pulls in swift-system 1.8.0
transitively. Scoped to the BrewCLI target only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Graeme Arthur
2026-08-12 22:53:27 +10:00
co-authored by Claude Opus 5
parent ebc927aaba
commit b0e42892a3
2 changed files with 37 additions and 1 deletions
+24
View File
@@ -0,0 +1,24 @@
{
"originHash" : "3a8c38daadbe8d3680d9ab6539cd679eca22d760ea4922effa380094d5189128",
"pins" : [
{
"identity" : "swift-subprocess",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-subprocess.git",
"state" : {
"revision" : "b3937ab85dd32f6e9435914599c1519074769c1a",
"version" : "1.0.0"
}
},
{
"identity" : "swift-system",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system",
"state" : {
"revision" : "704705c5c51156ede21172a38654d522ce487074",
"version" : "1.8.0"
}
}
],
"version" : 3
}
+13 -1
View File
@@ -25,6 +25,15 @@ let package = Package(
.library(name: "BrewFeatureDoctor", targets: ["BrewFeatureDoctor"]),
.library(name: "BrewFeatureConfig", targets: ["BrewFeatureConfig"]),
],
dependencies: [
// Justification (`CONVENTIONS.md` — Dependencies): running `brew` under a pseudo-terminal needs
// `setsid()` between fork and exec so the pty becomes the child's *controlling* terminal.
// `Foundation.Process` has no hook there and structurally cannot express it; `Subprocess` exposes it as
// `PlatformOptions.createSession`, along with the fd hand-off and process-group teardown the pty path
// needs. Confined to `BrewCLI` behind the `BrewCommandRunning` protocol, so it has exactly one conformer.
// Version pinned exactly, per the same convention.
.package(url: "https://github.com/swiftlang/swift-subprocess.git", exact: "1.0.0"),
],
targets: [
// Dependency-free by design: linked by both the app and the BrewUITests target, so it must
// not drag app code into the test bundle.
@@ -72,7 +81,10 @@ let package = Package(
),
.target(
name: "BrewCLI",
dependencies: ["BrewCore"],
dependencies: [
"BrewCore",
.product(name: "Subprocess", package: "swift-subprocess"),
],
swiftSettings: [
.defaultIsolation(nil),
.swiftLanguageMode(.v6),