Re: [Vala] Interpreting exit status



 
    > On Sunday, 5 May 2019, 15:36:38 BST, rastersoft <raster rastersoft com> wrote: > I have a little 
problem: I'm launching a process using 
GLib.Process.spawn_async, and use g_child_add_watch() to receive the 
exit status value....But waitpid documentation is not 
very clear... Can I assume that the value set by the "exit()" call in 
the spawned program is always stored in the upper 8 bits?

I can give some insight based on my own experience, which boils down to: - use GLib SubProcess - use the Open 
Group documentation for anything that is unclear with POSIX (Unix)
https://valadoc.org/gio-2.0/GLib.Subprocess.get_exit_status.html states 'This is equivalent to the system 
WEXITSTATUS macro' and http://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.htmlstates 
'WEXITSTATUS(stat_val) If the value of WIFEXITED(stat_val) is non-zero, this macro evaluates to the low-order 
8 bits of the status argumentthat the childprocess passed to _exit() or exit(), or the value the child 
process returned from main()'
I hope that helps.

Al
 


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