#29123 [Opn->WFx]: pclose() and proc_close() not returning proper exit status

From: Date: Thu, 15 Jul 2004 23:32:27 +0000
Subject: #29123 [Opn->WFx]: pclose() and proc_close() not returning proper exit status
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-62422@lists.php.net to get a copy of this message
ID: 29123 Updated by: iliaa@php.net Reported By: jtnix at maine dot rr dot com -Status: Open +Status: Wont fix Bug Type: Program Execution Operating System: Linux 2.4 PHP Version: 4.3.7 New Comment: When sigchild is used the return status from pclose and proc_close() cannot be retrieved. Previous Comments: ------------------------------------------------------------------------ [2004-07-13 19:37:14] jtnix at maine dot rr dot com Yes we are using oracle and --enable-sigchild. --enable-sigchild is not in use on the 4.3.3 install I tested. ------------------------------------------------------------------------ [2004-07-13 19:10:16] wez@php.net Are you using --enable-sigchild ? If so, and you're not using Oracle, turn it off. ------------------------------------------------------------------------ [2004-07-13 18:26:58] jtnix at maine dot rr dot com Description: ------------ version 4.3.7 proc_close() and pclose() are not returning proper exit status codes from spawned processes. Reproduce code: --------------- $cmd = "rsync /pinky /brain"; ## proc_ method $setup = array( 1 => array("pipe", "w")); $process = proc_open($cmd, $setup, $pipes); if (is_resource($process)) { while(!feof($pipes[1])) { echo fgets($pipes[1], 1024); } fclose($pipes[1]); $rv = proc_close($process); echo ":: proc_close() method ::\n"; echo "exit val: $rv\n\n"; } ## popen() method $phnd = popen("$cmd", 'r'); while (!feof($phnd)) { $in = fread($phnd, 2048); echo $read; } $rv = pclose($phnd); echo ":: pclose() ::\n"; echo "exit val: $rv\n\n"; Expected result: ---------------- ## PHP 4.3.3 ## link_stat /pinky : No such file or directory rsync error: some files could not be transferred (code 23) at main.c(620) :: proc_close() method :: exit val: 23 link_stat /pinky : No such file or directory rsync error: some files could not be transferred (code 23) at main.c(620) :: pclose() :: exit val: 23 Actual result: -------------- ## PHP 4.3.7 ## link_stat /pinky : No such file or directory rsync error: some files could not be transferred (code 23) at main.c(620) :: proc_close() method :: exit val: -1 link_stat /pinky : No such file or directory rsync error: some files could not be transferred (code 23) at main.c(620) :: pclose() :: exit val: -1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29123&edit=1

« previous php.bugs (#62422) next »