Skip to content

Commit b38222d

Browse files
committed
Fix an issue where standard error write file descriptor was incorrectly passed to fork/exec twice
1 parent 67e2f7d commit b38222d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/Subprocess/Platforms/Subprocess+Linux.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ extension Configuration {
8282
outputWriteFileDescriptor?.platformDescriptor() ?? -1,
8383
outputReadFileDescriptor?.platformDescriptor() ?? -1,
8484
errorWriteFileDescriptor?.platformDescriptor() ?? -1,
85-
errorWriteFileDescriptor?.platformDescriptor() ?? -1,
85+
errorReadFileDescriptor?.platformDescriptor() ?? -1,
8686
]
8787

8888
let workingDirectory: String = self.workingDirectory.string

Sources/_SubprocessCShims/process_shims.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,8 +641,8 @@ int _subprocess_fork_exec(
641641
if (file_descriptors[3] >= 0) {
642642
rc = close(file_descriptors[3]);
643643
}
644-
if (file_descriptors[4] >= 0) {
645-
rc = close(file_descriptors[4]);
644+
if (file_descriptors[5] >= 0) {
645+
rc = close(file_descriptors[5]);
646646
}
647647
if (rc != 0) {
648648
int error = errno;

0 commit comments

Comments
 (0)