[Kostas Oikonomou reports a strange return value from system()]

system() was changed awhile back to allow more redirection capabilities
than C system().  It now does a fork(), exec() and waitpid() to execute
the child process.  But, the status integer filled in by waitpid() is
not simply the exit status of the process, it seems to have a bunch of
other information (mainly flags) in it.

We have minimally a documentation bug and a backwards compatibility bug,
and we will want to think about how best to handle this waitpid() info.
If Shamim has an opinion on it, I'd like to get his take.

One possibility would be: system() returns an exit status if waitpid()'s
WIFEXITED(status) macro is true; and fails otherwise.

While we are at it, we should be looking at waitpid's return value to see
if it is -1, and think about whether waitpid()'s full status information
needs to be returned and if so, how.

In the mean time, Kostas, you can interpret your system() return value as
a waitpid() status parameter, which includes an exit code as part of it,
if the process terminated normally.  See the man page for waitpid().  We
could build Unicon equivalents of the C macros, if we don't "fix" this
return value, but I suspect we will fix the return value to be backward
compatible in some way.

Cheers,
Clint


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to