Skip to content

Commit

Permalink
Fix to #435 (wrong stdin fd closed.)
Browse files Browse the repository at this point in the history
(With apologies to @neonichu.)

The previous commit closes the wrong file descriptor for `stdin`, which should close the duplicated _read_ descriptor (whereas `stdout` and `stderr` duplicate their _write_ descriptors.) This PR fixes that.
  • Loading branch information
grynspan committed Nov 7, 2023
1 parent cf8a8a0 commit c19d749
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/TSCBasic/Process.swift
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ 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[1])
posix_spawn_file_actions_addclose(&fileActions, stdinPipe[0])

var outputPipe: [Int32] = [-1, -1]
var stderrPipe: [Int32] = [-1, -1]
Expand Down

0 comments on commit c19d749

Please sign in to comment.