Skip to content

Commit

Permalink
Merge branch 'wip/T247' of github.com:bgamari/process
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Jun 15, 2022
2 parents d7bafbb + f5e10c4 commit 5546928
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cbits/posix/fork_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ setup_std_handle_fork(int fd,
return 0;

case STD_HANDLE_USE_FD:
if (dup2(b->use_fd, fd) == -1) {
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
// Sur.
if (b->use_fd != fd) {
if (dup2(b->use_fd, fd) == -1) {
child_failed(pipe, "dup2");
}
}
return 0;

Expand Down

0 comments on commit 5546928

Please sign in to comment.