Looks interesting.  Could you submit this as a patch to Emacs?
Not sure if I can. Though it's mostly boilerplate code, I lifted most of the code from here http://blog.borovsak.si/2009/07/spawning-processes-using-glib.html .