Re: Distinguish between G_IO_ERR and G_IO_HUP



Tim Müller wrote:
When the child exits, the callback function you passed to g_child_watch_add() is called with the exit status of the child, which will tell you if the child exited with an error or not. On unix, you'll need the macros described in the waitpid manpage to interpret the exit code (e.g. if (WIFEXITED(status) && WEXITSTATUS(status) == EXIT_SUCCESS) then it's a normal exit, otherwise there was an error or the program received a fatal signal). No idea how to interpret the exit code on win32.

So I have to use g_child_watch_add() only or also with:
SetIOChannel (output_fd, G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL,ZipOutput, NULL );

GIOChannel *SetIOChannel (gint fd, GIOCondition cond, GIOFunc func, gpointer data)
{
        GIOChannel *ioc;
        /* set up handler for data */
        ioc = g_io_channel_unix_new(fd);
        g_io_add_watch (ioc, cond, func, data);
        return ioc;
}

Both of them or g_child_watch_add replaces g_io_add_watch ??
--
Colossus

Cpsed, a Linux OpenGL 3D scene editor
http://cpsed.sourceforge.net/




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