STINNER Victor <vstin...@python.org> 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 function compared to exiting code:

* the function guarantee that result >= 0 means that the process exited and 
result < 0 means that the process exited due to a signal (was killed by a 
signal)
* the function raises a well defined exception (ValueError) if the WIFSTOPPED() 
is true or if the status is unknown: it prevents to misuse WIFSTOPPED()

----------
title: Add os._wait_status_to_returncode() helper function -> Add 
os.status_to_exitcode() function

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40094>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to