Weird stdout/stderr indefinite loop with vala async exec / pipe example

Weird stdout/stderr indefinite loop with vala async exec / pipe example



I tried out the example about exec and spawning, when running this with vala or compiling with valac, I get an endless loop of the output below. Is that normal? Incidentally, this is on OS X, normally I am on Linux and I can test it later on Linux.
Vala version 0.40.9 installed with brew, using glib version 2.58.0 also installed with brew.


out: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stderr: (null)stdout: (null)stde



Edit: When running the same example on Ubuntu Xenial it worked as expected, but it is also using vala 0.30.1 by default. Is that just a way too old version? But at least now I saw what the example should look like.



Edit2: The code used is 'Spawn with pipes, async' from https://valadoc.org/glib-2.0/GLib.Process.spawn_async_with_pipes.html without any modifications, just copy pasted.


private static bool process_line (IOChannel channel, IOCondition condition, string stream_name)
if (condition == IOCondition.HUP)
print ("%s: The fd has been closed.n", stream_name);
return false;


try
string line;
channel.read_line (out line, null, null);
print ("%s: %s", stream_name, line);
catch (IOChannelError e)
print ("%s: IOChannelError: %sn", stream_name, e.message);
return false;
catch (ConvertError e)
print ("%s: ConvertError: %sn", stream_name, e.message);
return false;


return true;


public static int main (string args)
MainLoop loop = new MainLoop ();
try
string spawn_args = "ls", "-l", "-h";
string spawn_env = Environ.get ();
Pid child_pid;

int standard_input;
int standard_output;
int standard_error;

Process.spawn_async_with_pipes ("/",
spawn_args,
spawn_env,
SpawnFlags.SEARCH_PATH catch (SpawnError e)
print ("Error: %sn", e.message);

return 0;



The bug report is here: https://gitlab.gnome.org/GNOME/glib/issues/1512





Please add the actual code you're using. The problem may depend on a great of things like the GLib version, the C compiler version, the OS version, etc. Please add as many details as possible.
– Jens Mühlenhoff
Sep 1 at 14:39





Added the code. Additional details to follow after reboot.
– step21
Sep 1 at 16:58





It seems like you found a bug and/or limitation of GIO on macOS. Try using a newer version of GLib if possible. If that does not help, you can write a bug report a bug to gitlab.gnome.org/GNOME/glib/issues
– Jens Mühlenhoff
Sep 2 at 15:09






It was run using glib version 2.58.0 also installed with brew.
– step21
Sep 4 at 22:41






Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Some of your past answers have not been well-received, and you're in danger of being blocked from answering.



Please pay close attention to the following guidance:



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)