GNOME Bugzilla – Bug 150251
g_child_add_watch
Last modified: 2005-09-18 01:22:42 UTC
This is a reminder that we should add a wrapper for this function at the next opportunity. No, there is no python equivalent API. Although the same can be implemented in python, it is not trivial (though not too complicated either).
Created attachment 32301 [details] [review] implement gobject.child_watch_add It doesn't seem to be working. jpe suggested this api probably only works in conjunction with g_spawn_*, and I suspect he may be right. So, even though I said in the past we didn't need to wrap g_spawn_*, now there is a good reason to do so.
Created attachment 32310 [details] [review] new version, now works OK, I got it working. It seems to work with g_spawn_*. However, it is not reliable for programs that quit very quickly after creation. In the test, the child process sleeps for one second, and this way it works.
"It seems to work with g_spawn_*." --> I meant _without_ g_spawn_*.
Created attachment 32367 [details] [review] updated patch, added g_spawn_async_with_pipes wrapper Unfortunately, even with g_spawn_async the bug remains :-( I have detected at least two glib bugs already: 1. multiple g_child_watch_add's don't work; 2. g_child_watch_add doesn't work if child terminates too quickly.
I'd like to include this in 2.6, if no one opposes. Question: do we include the g_spawn_async_with_pipes wrapper or not?
It would be nice to document these new functions: - gobject.child_watch_add - gobject.sapwn_async
Created attachment 52106 [details] [review] document gobject.child_watch_add
docs added 2.8.1 ref with main_depth() and get_current_time()