fix hanging waitpid on macos