We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d7bafbb + f5e10c4 commit 5546928Copy full SHA for 5546928
cbits/posix/fork_exec.c
@@ -69,8 +69,13 @@ setup_std_handle_fork(int fd,
69
return 0;
70
71
case STD_HANDLE_USE_FD:
72
- if (dup2(b->use_fd, fd) == -1) {
73
- child_failed(pipe, "dup2");
+ // N.B. POSIX specifies that dup2(x,x) should be a no-op, but
+ // naturally Apple ignores this and rather fails in posix_spawn on Big
74
+ // Sur.
75
+ if (b->use_fd != fd) {
76
+ if (dup2(b->use_fd, fd) == -1) {
77
+ child_failed(pipe, "dup2");
78
+ }
79
}
80
81
0 commit comments