Skip to content
  • danielsdeleo's avatar
    Wait for child process to die in case of critical errors · 89f7f802
    danielsdeleo authored
    Ported the regression test from OHAI-455 to mixlib-shellout, which
    revealed a race condition in the way shellout reaps the child after a
    failed exec (most commonly caused by attempting to run a command that
    doesn't exist). The call to waitpid2 used WNOHANG to avoid hanging
    indefinitely if an error was caused but the child process was still
    alive, but this results in the child process not getting reaped if it
    exits after the call to waitpid2. In a single run of the stress test,
    this occurred 94/100 times, so it is very likely that mixlib-shellout
    will leak zombies for the ENOENT case without this change.
    89f7f802