mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-40094: Add os.waitstatus_to_exitcode() (GH-19201)
Add os.waitstatus_to_exitcode() function to convert a wait status to an exitcode. Suggest waitstatus_to_exitcode() usage in the documentation when appropriate. Use waitstatus_to_exitcode() in: * multiprocessing, os, subprocess and _bootsubprocess modules; * test.support.wait_process(); * setup.py: run_command(); * and many tests.
This commit is contained in:
parent
5dd836030e
commit
65a796e527
18 changed files with 258 additions and 61 deletions
|
@ -864,12 +864,8 @@ if _exists("fork") and not _exists("spawnv") and _exists("execv"):
|
|||
wpid, sts = waitpid(pid, 0)
|
||||
if WIFSTOPPED(sts):
|
||||
continue
|
||||
elif WIFSIGNALED(sts):
|
||||
return -WTERMSIG(sts)
|
||||
elif WIFEXITED(sts):
|
||||
return WEXITSTATUS(sts)
|
||||
else:
|
||||
raise OSError("Not stopped, signaled or exited???")
|
||||
|
||||
return waitstatus_to_exitcode(sts)
|
||||
|
||||
def spawnv(mode, file, args):
|
||||
"""spawnv(mode, file, args) -> integer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue