#41875 [NEW]: io_add_watch can't detect HUPs

From: Date: Mon, 02 Jul 2007 19:04:10 +0000
Subject: #41875 [NEW]: io_add_watch can't detect HUPs
Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-3913@lists.php.net to get a copy of this message
From: sebastianmarconi at gmail dot com Operating system: Windows XP PHP version: 5.2.3 PHP Bug Type: PHP-GTK related Bug description: io_add_watch can't detect HUPs Description: ------------ It seems that Gtk::io_add_watch can't detect HUP conditions using beta Windows binary with Gtk+ 2.10. In some cases the only workaround that I've found is to look the process status info [1] in the STDOUT callback (sometimes it sends IO_IN signals constantly), but randomly losses some information. [1] <?php $status = proc_get_status($proc_id); if (! $status['running']) { $this->io_hup($pipe); } ?> Reproduce code: --------------- <?php function out($pipe) { echo "STDOUT\n"; echo stream_get_contents($pipe); } function hup($pipe){ echo "HUP\n"; Gtk::main_quit(); return false; } $pipes = null; $descriptor = array( 0 => array("pipe", "r"), // stdin 1 => array("pipe", "w"), // stdout is a pipe that the child will write to 2 => array("pipe", "w") // stderr ); $cmd = 'dir'; $p = proc_open($cmd, $descriptor, $pipes); Gtk::io_add_watch($pipes[1],Gtk::IO_IN, 'out'); Gtk::io_add_watch($pipes[1],Gtk::IO_HUP, 'hup'); Gtk::main(); echo "EXIT\n"; fclose($pipes[0]); fclose($pipes[1]); fclose($pipes[2]); ?> Expected result: ---------------- STDOUT [Dir contents] HUP EXIT Actual result: -------------- STDOUT [The script hangs] -- Edit bug report at http://bugs.php.net/?id=41875&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41875&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41875&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41875&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41875&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41875&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41875&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41875&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41875&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41875&r=support Expected behavior: http://bugs.php.net/fix.php?id=41875&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41875&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41875&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41875&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41875&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41875&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41875&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41875&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41875&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41875&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41875&r=mysqlcfg

« previous php.gtk.dev (#3913) next »