Re: Gtk::input_add() for a popen() filehandle?
| From: | Alan Knowles | Date: | Sun, 31 Mar 2002 13:40:03 +0000 |
| Subject: | Re: Gtk::input_add() for a popen() filehandle? | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-1686@lists.php.net to get a copy of this message | ||
Having had a quick hunt through the code for this, it appears that if you replaced the call with the le_popen check, the value in *source should be the return value from the popen call - so if this worked in C - it should be possible in gtk.
you could try doing a couple of sprintf's in the php4/ext/file.c and/or php4/TSRM/tsrm_virtual_cmd.c and gtk.overides to find out the exact values that are getting sent back and forth, and compare this with the C version.
eg.
if (!php_gtk_parse_args(3, "riV", &source_rsrc, &condition, &callback))
return;source = zend_list_find(Z_LVAL_P(source_rsrc), &rsrc_type); if (!source || rsrc_type != php_file_le_popen()) {
php_error(E_WARNING, "%s() expects argument 1 to be a valid filehandle resource", get_active_function_name(TSRMLS_C));
return;
}
php_error(E_WARNING, "Debugging input_add : %x %d", source,source);
etc.
I wasnt aware of this function - it would be amazingly usefull if it could work....
regards
alan
James Cameron wrote:
G'day, I'm trying to write an application using PHP-GTK that will run rsync over ssh in a pipe, so that I can update the GUI according to the progress (or failure) of the rsync. If I were using C, then I would use popen(), obtain the file descriptor for the pipe, and then hand it to gtk_input_add_full() so that I can return control to the GTK+ event loop, and be informed when input arrives. I've done this successfully in C before. However, the PHP-GTK function Gtk::input_add() only accepts an fopen() filehandle. The check is in ext/gtk+/gtk.overrides:288 (rev 1.48) and changing it to allow popen() filehandles doesn't seem to work. The callback is not called. I presume the filehandle types are different. Can anyone suggest how to fix this?