Re: Call external programs and keep showing its outputs
- From: Kang Hu <hukangustc gmail com>
- To: Woody Wu <narkewoody gmail com>
- Cc: gtk-list <gtk-list gnome org>
- Subject: Re: Call external programs and keep showing its outputs
- Date: Thu, 10 Oct 2013 19:35:09 +0800
1. call g_spawn_async_with_pipes and get the stdin, stdout, stderr fds.
2. call g_child_watch on the pid returned in step 1.
3. create an io channel for each fd ( see g_io_channel_unix_new)
4. add each io channel to the main loop ( see g_io_add_watch) .
read external application output (see g_io_channel_read_*) in the callback function GIOFunc
and update your widget's text section
5. you can kill external programs by the pid you get in step 1.
NOTE: you need to release fds in callbacks in step 2.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]