Skip to content

Commit

Permalink
Remove redundant addclose calls (#435)
Browse files Browse the repository at this point in the history
We shouldn't need to use addclose on the file descriptors we're closing ourselves explicitly.
  • Loading branch information
neonichu authored and grynspan committed Nov 9, 2023
1 parent 4d539ff commit 0dc3ba4
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions Sources/TSCBasic/Process.swift
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,6 @@ public final class Process {
posix_spawn_file_actions_adddup2(&fileActions, stdinPipe[0], 0)

// Close the other side's pipe since it was dupped to 0.
posix_spawn_file_actions_addclose(&fileActions, stdinPipe[0])
posix_spawn_file_actions_addclose(&fileActions, stdinPipe[1])

var outputPipe: [Int32] = [-1, -1]
Expand All @@ -699,7 +698,6 @@ public final class Process {
posix_spawn_file_actions_adddup2(&fileActions, outputPipe[1], 1)

// Close the other ends of the pipe since they were dupped to 1.
posix_spawn_file_actions_addclose(&fileActions, outputPipe[0])
posix_spawn_file_actions_addclose(&fileActions, outputPipe[1])

if outputRedirection.redirectStderr {
Expand All @@ -711,7 +709,6 @@ public final class Process {
posix_spawn_file_actions_adddup2(&fileActions, stderrPipe[1], 2)

// Close the other ends of the pipe since they were dupped to 2.
posix_spawn_file_actions_addclose(&fileActions, stderrPipe[0])
posix_spawn_file_actions_addclose(&fileActions, stderrPipe[1])
}
} else {
Expand Down

0 comments on commit 0dc3ba4

Please sign in to comment.