--- libpkg/scripts.c +++ libpkg/scripts.c @@ -245,12 +245,19 @@ f = fdopen(pfd.fd, "r"); for (;;) { - if (poll(&pfd, 1, -1) == -1) { + int pres = poll(&pfd, 1, 1000); + if (pres == -1) { if (errno == EINTR) continue; else goto cleanup; } + if (pres == 0) { + if (waitpid(pid, NULL, WNOHANG | WNOWAIT) > 0) { + break; + } + continue; + } if (pfd.revents & (POLLERR|POLLHUP)) break; if (getline(&line, &linecap, f) > 0)