Re: Newbie problems using g_spawn_async_with_pipes and watching for IO




On Feb 20, 2013 9:28 AM, "Ian Liu Rodrigues" <ian liu88 gmail com> wrote:
>
> If you only need the return code and output, you might find this method more usefull: http://developer.gnome.org/glib/stable/glib-Spawning-Processes.html#g-spawn-command-line-sync
>
> Ian
>
>
> On Tue, Feb 19, 2013 at 10:28 PM, Will Orr <ay1244 gmail com> wrote:
>>
>> Here[1] is the problematic code.
>>
>> I'm trying to run a command and gather the output and return code. I
>> do this by watching for the process to return, as well as waiting for
>> the channels to HUP. However, my callbacks never get called with cond
>> set to G_IO_HUP, even after the process terminates. Nor do any of the
>> g_io_channel_read_* calls return errors. This seems inconsistent with
>> the documentation, as well as examples that I've found in the hours of
>> researching this problem.
>>
>> I'm clearly doing something wrong, I'm just not sure where yet. Any
>> advice or solutions would be great. Thanks so much! Let me know if I
>> need to provide anymore information. Please CC me, as I'm not a member
>> of this list.
>>
>>
>> [1] https://gist.github.com/worr/4991859
>>
>> --
>> Will Orr
>>
>> http://about.me/worr
>> _______________________________________________
>> gtk-list mailing list
>> gtk-list gnome org
>> https://mail.gnome.org/mailman/listinfo/gtk-list
>
>

Unfortunately I need to be able to kill the process after a certain amount of time has passed, as well as provide stdin, so that function does not suit my needs.

I have not implemented those features yet because I haven't gotten this simple snippet to work.

Thanks for the suggestion though.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]