[Interest] Return value from QProcess

Thiago Macieira thiago.macieira at intel.com
Thu Apr 7 18:16:57 CEST 2016


On quinta-feira, 7 de abril de 2016 08:47:05 PDT Duane wrote:
> >> /* If WIFEXITED(STATUS), the low-order 8 bits of the status.  */
> >> #define	__WEXITSTATUS(status)	(((status) & 0xff00) >> 8)
> > 
> > BTW
> > 
> > $ printf %x\\n 4531
> > 11b3
> > 
> > 0x11 is 17. So QProcess is correct.
> 
> Thanks.  Actually 4531 was a typo.  It returns 4352 which is 1100.
> So that explains it. std::system is returning it as an int. But then
> again, QProcess::exitCode() is supposed to be returning it as an int as
> well...

It does and is correct. Both have correct return values.

Your code dealing with system wasn't. You were supposed to use WEXITSTATUS on 
the int it returned to obtain the return code. From the system(3) man page:

       In the last two cases, the return value is a "wait status"  that  can
       be  examined using the macros described in waitpid(2).  (i.e., 
       WIFEXITED(), WEXITSTATUS(), and so on).


-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list