Skip to content

Commit 412d145

Browse files
committed
Remove calls to defer { withExtendedLifetime }
1 parent 630c3e0 commit 412d145

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

Sources/SWBUtil/Process.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ extension Process {
8585
let stdoutPipe = Pipe()
8686
let stderrPipe = Pipe()
8787

88-
// Extend the lifetime of the pipes to avoid file descriptors being closed until the AsyncStream is finished being consumed.
89-
defer { withExtendedLifetime(stdoutPipe) {} }
90-
defer { withExtendedLifetime(stderrPipe) {} }
91-
9288
let (exitStatus, output) = try await _getOutput(url: url, arguments: arguments, currentDirectoryURL: currentDirectoryURL, environment: environment, interruptible: interruptible) { process in
9389
let stdoutStream = process.makeStream(for: \.standardOutputPipe, using: stdoutPipe)
9490
let stderrStream = process.makeStream(for: \.standardErrorPipe, using: stderrPipe)
@@ -103,10 +99,6 @@ extension Process {
10399
let stdoutPipe = Pipe()
104100
let stderrPipe = Pipe()
105101

106-
// Extend the lifetime of the pipes to avoid file descriptors being closed until the AsyncStream is finished being consumed.
107-
defer { withExtendedLifetime(stdoutPipe) {} }
108-
defer { withExtendedLifetime(stderrPipe) {} }
109-
110102
let (exitStatus, output) = try await _getOutput(url: url, arguments: arguments, currentDirectoryURL: currentDirectoryURL, environment: environment, interruptible: interruptible) { process in
111103
let stdoutStream = process._makeStream(for: \.standardOutputPipe, using: stdoutPipe)
112104
let stderrStream = process._makeStream(for: \.standardErrorPipe, using: stderrPipe)
@@ -124,9 +116,6 @@ extension Process {
124116
if #available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) {
125117
let pipe = Pipe()
126118

127-
// Extend the lifetime of the pipes to avoid file descriptors being closed until the AsyncStream is finished being consumed.
128-
defer { withExtendedLifetime(pipe) {} }
129-
130119
let (exitStatus, output) = try await _getOutput(url: url, arguments: arguments, currentDirectoryURL: currentDirectoryURL, environment: environment, interruptible: interruptible) { process in
131120
process.standardOutputPipe = pipe
132121
process.standardErrorPipe = pipe
@@ -138,9 +127,6 @@ extension Process {
138127
} else {
139128
let pipe = Pipe()
140129

141-
// Extend the lifetime of the pipes to avoid file descriptors being closed until the AsyncStream is finished being consumed.
142-
defer { withExtendedLifetime(pipe) {} }
143-
144130
let (exitStatus, output) = try await _getOutput(url: url, arguments: arguments, currentDirectoryURL: currentDirectoryURL, environment: environment, interruptible: interruptible) { process in
145131
process.standardOutputPipe = pipe
146132
process.standardErrorPipe = pipe

0 commit comments

Comments
 (0)