Receiving G_IO_HUP when reading output of g_spawn'ed Ruby script



Hello,

I have written a small plugin for Audacious
(http://audacious-media-player.org/), which utilises an external script to
retrieve lyrics and displays them in a window. I have a strange problem.

The way I call this external script is this:

result = g_spawn_async_with_pipes(NULL,
                command,
                NULL,
                G_SPAWN_DO_NOT_REAP_CHILD,
                NULL,
                NULL,
                &pid,
                NULL,
                &script_out,
                &script_err,
                &gerr);

...

iochannel = g_io_channel_unix_new(script_out);
g_io_add_watch(iochannel, (G_IO_IN|G_IO_HUP), wikilyrics_get_output, data);
...

Extra information: the script is written in Ruby, and with the switches I
feed it, it spits the lyrics in its stdout. I have tested this by hand and
it works.

My problem is this: whenever I run audacious from a terminal, everything
goes fine. When the script produces output G_IO_IN is emitted and I
correctly receive the lyrics. However, if I run audacious from the "Run"
dialog (Alt+F2), G_IO_HUP is emitted and I get a null output. Instead,
stderr reports "Error opening terminal: unknown".

Can anyone explain this and help me resolve it?

Alexander Altanis



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