Revamp posix_spawn() implementation

This commit is contained in:
Justine Tunney 2022-10-12 05:26:58 -07:00
parent b41f91c658
commit 0cee831da3
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
15 changed files with 383 additions and 215 deletions

View file

@ -54,7 +54,7 @@ FILE *popen(const char *cmdline, const char *mode) {
switch ((pid = fork())) {
case 0:
_unassert(dup2(pipefds[!dir], !dir) == !dir);
// we can't rely on cloexec because cocmd builtins don't execev
// we can't rely on cloexec because cocmd builtins don't execve
if (pipefds[0] != !dir) _unassert(!close(pipefds[0]));
if (pipefds[1] != !dir) _unassert(!close(pipefds[1]));
_Exit(cocmd(3, (char *[]){"popen", "-c", cmdline, 0}));