Edit report at http://bugs.php.net/bug.php?id=52173&edit=1
ID: 52173 Updated by: [email protected] Reported by: nick dot telford at gmail dot com Summary: ext/pcntl doesn't store/report errors -Status: Open +Status: To be documented Type: Feature/Change Request Package: PCNTL related Operating System: Linux PHP Version: trunk-SVN-2010-06-24 (SVN) Block user comment: N New Comment: Fixed, thanks ! Previous Comments: ------------------------------------------------------------------------ [2010-11-01 21:22:26] [email protected] Automatic comment from SVN on behalf of lbarnaud Revision: http://svn.php.net/viewvc/?view=revision&revision=305016 Log: MFH Fix bug #52173 (ext/pcntl doesn't store/report errors) (patch by nick dot telford at gmail dot com) ------------------------------------------------------------------------ [2010-11-01 21:10:19] [email protected] Automatic comment from SVN on behalf of lbarnaud Revision: http://svn.php.net/viewvc/?view=revision&revision=305015 Log: Fix bug #52173 (ext/pcntl doesn't store/report errors) (patch by nick dot telford at gmail dot com) ------------------------------------------------------------------------ [2010-06-24 19:10:03] nick dot telford at gmail dot com I've attached a patch that implements solution #3. The patch used the extent of my amazing copy/paste skills to extract the posix_get_last_error() and posix_strerror() functionality from ext/posix and duplicate it in ext/pcntl. If there's anything wrong with this patch, please let me know. But let me down lately - this is the first time I've written (if you can call it that) any C, let alone worked on a PHP extension. We've all gotta start somewhere :) If you need me to write tests etc. please let me know, also any tips on how to go about doing so. I've tested this using the example in the description and it works a treat. ------------------------------------------------------------------------ [2010-06-24 18:19:05] [email protected] I like option #3. ------------------------------------------------------------------------ [2010-06-24 16:58:59] nick dot telford at gmail dot com Minor addendum: A solid use-case as to why it is useful for the userland code to read the error code. When calling pcntl_wait(), -1 will be returned if there are no child processes running (errno == ECHILD) and also if the call is interrupted by a signal (errno == EINTR). This makes determining whether there are children left to wait on tricky, as -1 could simply be an interrupt from a signal being handled. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=52173 -- Edit this bug report at http://bugs.php.net/bug.php?id=52173&edit=1
