In a related question , I asked where to find the documentation for the wait function. It was an attempt to find out return codes for the commands.getstatusoutput () module. Stackoverflow passed, but the documentation did not help. Here's what puzzles me:
import commands
goodcommand = 'ls /'
badcommand = 'ls /fail'
status, output = commands.getstatusoutput(goodcommand)
print('Good command reported status of %s' % status)
status, output = commands.getstatusoutput(badcommand)
print('Bad command reported status of %s' % status)
When running on OS X (Leopard), I get the following output: (which matches the documentation.)
$ python waitest.py
Good command reported status of 0
Bad command reported status of 256
On OS X running "ls / fail; echo $?" gets the following result:
$ ls /fail ; echo $?
ls: /fail: No such file or directory
1
When running on Linux (Ubuntu Hardy), I get the following output:
$ python waitest.py
Good command reported status of 0
Bad command reported status of 512
On Ubuntu, running "ls / fail" gets 2:
$ ls /fail ; echo $?
ls: cannot access /fail: No such file or directory
2
So, Python seems to be multiplying state codes by 256. Huh? Is it documented anywhere?