I am working on Linux with code that calls a call system()to run a python program. I am interested in the value returned by this function call in order to understand how the python program was executed.
So far I have found 3 results:
When the python process succeeds, the value returned by system () is 0
When a python process is killed in the middle of execution (using kill -9 pid), the value returned by system () is 9
When a python process crashes due to incorrect parameters, the value returned by system () is 512
This is not what I read about the system () function .
In addition, the python program's startup code shows that it exits sys.exit(2)when any error occurs and sys.exit(0)when execution completes successfully.
Can anyone link these two? Am I misinterpreting the return value? Is there some kind of Linux processing that takes an argument to sys.exit()a python program function and returns a value system()based on it?
source
share