diff --git a/core/utils.c b/core/utils.c index e949f46e..138bb49d 100644 --- a/core/utils.c +++ b/core/utils.c @@ -3295,7 +3295,27 @@ pid_t uwsgi_run_command(char *command, int *stdin_fd, int stdout_fd) { } uwsgi_close_all_sockets(); - uwsgi_close_all_fds(); + //uwsgi_close_all_fds(); + int i; + for (i = 3; i < (int) uwsgi.max_fd; i++) { + if (stdin_fd) { + if (i == stdin_fd[0] || i == stdin_fd[1]) { + continue; + } + } + if (stdout_fd > -1) { + if (i == stdout_fd) { + continue; + } + } +#ifdef __APPLE__ + fcntl(i, F_SETFD, FD_CLOEXEC); +#else + close(i); +#endif + } + + if (stdin_fd) { close(stdin_fd[1]);