From: Slaven Rezic Date: Thu, 8 Jan 2009 12:05:58 +0000 (+0100) Subject: about warnings if forks fail in Perl_my_popen X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b3647a361211e9f2a6bf737a259cceab1db864a9;p=p5sagit%2Fp5-mst-13.2.git about warnings if forks fail in Perl_my_popen --- diff --git a/pod/perldiag.pod b/pod/perldiag.pod index cb82633..ae9d37c 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -757,11 +757,16 @@ If you didn't mean to use a Unicode property, escape the C<\p>, either by C<\\p> (just the C<\p>) or by C<\Q\p> (the rest of the string, until possible C<\E>). -=item Can't fork +=item Can't fork: %s (F) A fatal error occurred while trying to fork while opening a pipeline. +=item Can't fork, trying again in 5 seconds + +(W) A fork in a piped open failed with EAGAIN and will be retried +after five seconds. + =item Can't get filespec - stale stat buffer? (S) A warning peculiar to VMS. This arises because of the difference diff --git a/util.c b/util.c index c4fa794..86c06f5 100644 --- a/util.c +++ b/util.c @@ -2288,6 +2288,8 @@ Perl_my_popen_list(pTHX_ const char *mode, int n, SV **args) } return NULL; } + if (ckWARN(WARN_PIPE)) + Perl_warner(aTHX_ packWARN(WARN_PIPE), "Can't fork, trying again in 5 seconds"); sleep(5); } if (pid == 0) { @@ -2433,9 +2435,11 @@ Perl_my_popen(pTHX_ const char *cmd, const char *mode) PerlLIO_close(pp[1]); } if (!doexec) - Perl_croak(aTHX_ "Can't fork"); + Perl_croak(aTHX_ "Can't fork: %s", Strerror(errno)); return NULL; } + if (ckWARN(WARN_PIPE)) + Perl_warner(aTHX_ packWARN(WARN_PIPE), "Can't fork, trying again in 5 seconds"); sleep(5); } if (pid == 0) {