[issue40094] Add os.status_to_exitcode() function

2020-03-30 Thread STINNER Victor
STINNER Victor added the comment: > Other name ideas: > * wait_status_to_exit_code() Well, anothe option is: * waitstatus_to_exitcode() While the documentation uses "exit code", the code commonly uses "exitcode" or "returncode". Moreover, in the os module, underscore is not used to separate

[issue40094] Add os.status_to_exitcode() function

2020-03-29 Thread STINNER Victor
STINNER Victor added the comment: The function can be used to convert the result of the following functions: * os.system() (on Unix) * os.wait() * os.waitpid() * os.wait3() * os.wait4() * pty.spawn() Note: waitid() has a different API, si_status can be used directly, its meaning depends on s

[issue40094] Add os.status_to_exitcode() function

2020-03-29 Thread STINNER Victor
STINNER Victor added the comment: Interesting information about process "exit status code": https://en.wikipedia.org/wiki/Exit_status -- ___ Python tracker ___ ___

[issue40094] Add os.status_to_exitcode() function

2020-03-29 Thread STINNER Victor
STINNER Victor added the comment: I modified my PR to add Windows support. On Windows, os.waitpid() status also requires an operation (shif right by 8 bits) to get an exitcode from the waitpid status. So IMO it's worth it to add it to Windows as well, which makes the function even more usefu

[issue40094] Add os.status_to_exitcode() function

2020-03-28 Thread STINNER Victor
STINNER Victor added the comment: Hum, I changed my mind and I think that it's worth it to make the function public. Moreover, I prefer "exitcode", since it is closer to "WEXITSTATUS" name than "returncode". So I renamed the function os.status_to_exitcode(). Advantages of the new new functio