return value of spawnl() function

Hi every one,

I used spawn() function to execute a child process.

In the document, the return value of spawn() is the exit status of child process(mode P_WAIT, when spawn() return no error), but when I check, it seems the return value is left-shift 8 bits of the exit status of child process.

Are there some mistakes here?


You need to use the WEXITSTATUS macro to examine it (it basically does a >>8).

Hey Steve are you watching? WEXISTSTATUS is mention in system() but not in spawn*()

A bit late, but yes I am. I’ll update the docs.