Re: Fwd: mutt returns a 256 error code

2015-10-14 Thread Ian Collier
On Tue, Oct 13, 2015 at 01:51:31PM -0500, David Champion wrote:
> The return from python's os.system is not the same as the exit status.
> You need os.WEXITSTATUS(os.system(command)), which should be 0, or
> success.

Although this is system-dependent, one popular implementation has:

#define __WEXITSTATUS(status)   (((status) & 0xff00) >> 8)

so if system() returned 256 then the exit code was most likely 1, or failure.

However, this does not tell you why it failed - need to look elsewhere
for that.

imc


Re: Fwd: mutt returns a 256 error code

2015-10-14 Thread Cameron Simpson

On 14Oct2015 16:31, Ian Collier  wrote:

On Tue, Oct 13, 2015 at 01:51:31PM -0500, David Champion wrote:

The return from python's os.system is not the same as the exit status.
You need os.WEXITSTATUS(os.system(command)), which should be 0, or
success.


Although this is system-dependent, one popular implementation has:

#define __WEXITSTATUS(status)   (((status) & 0xff00) >> 8)


I'm pretty sure that is portable across UNIXen. Counter examples welcome to 
correct my knowledge.



so if system() returned 256 then the exit code was most likely 1, or failure.


Yep.


However, this does not tell you why it failed - need to look elsewhere
for that.


Mathieu replied to me directly, off list, by accident I think. I've asked if 
he'd like to come back on list. He's traced his issue to running his daemon 
from a boot script where $HOME isn't what he expected. I'm hoping to discuss 
that further on list after he replies.


Cheers,
Cameron Simpson 

I have seen all the works that are done under the sun;
and, behold, all is vanity and vexation of spirit.