Skip to content

Commit c8dd641

Browse files
bpo-40094: Enhance os.WIFEXITED documentation (GH-19244) (GH-19278)
(cherry picked from commit 7c72383) Co-authored-by: Victor Stinner <[email protected]>
1 parent f2b83c7 commit c8dd641

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

Doc/library/os.rst

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3765,45 +3765,55 @@ used to determine the disposition of a process.
37653765
Return ``True`` if a core dump was generated for the process, otherwise
37663766
return ``False``.
37673767

3768+
This function should be employed only if :func:`WIFSIGNALED` is true.
3769+
37683770
.. availability:: Unix.
37693771

37703772

37713773
.. function:: WIFCONTINUED(status)
37723774

3773-
Return ``True`` if the process has been continued from a job control stop,
3774-
otherwise return ``False``.
3775+
Return ``True`` if a stopped child has been resumed by delivery of
3776+
:data:`~signal.SIGCONT` (if the process has been continued from a job
3777+
control stop), otherwise return ``False``.
3778+
3779+
See :data:`WCONTINUED` option.
37753780

37763781
.. availability:: Unix.
37773782

37783783

37793784
.. function:: WIFSTOPPED(status)
37803785

3781-
Return ``True`` if the process has been stopped, otherwise return
3782-
``False``.
3786+
Return ``True`` if the process was stopped by delivery of a signal,
3787+
otherwise return ``False``.
37833788

3784-
.. availability:: Unix.
3789+
:func:`WIFSTOPPED` only returns ``True`` if the :func:`waitpid` call was
3790+
done using :data:`WUNTRACED` option or when the process is being traced (see
3791+
:manpage:`ptrace(2)`).
37853792

3793+
.. availability:: Unix.
37863794

37873795
.. function:: WIFSIGNALED(status)
37883796

3789-
Return ``True`` if the process exited due to a signal, otherwise return
3797+
Return ``True`` if the process was terminated by a signal, otherwise return
37903798
``False``.
37913799

37923800
.. availability:: Unix.
37933801

37943802

37953803
.. function:: WIFEXITED(status)
37963804

3797-
Return ``True`` if the process exited using the :manpage:`exit(2)` system call,
3805+
Return ``True`` if the process exited terminated normally, that is,
3806+
by calling ``exit()`` or ``_exit()``, or by returning from ``main()``;
37983807
otherwise return ``False``.
37993808

38003809
.. availability:: Unix.
38013810

38023811

38033812
.. function:: WEXITSTATUS(status)
38043813

3805-
If ``WIFEXITED(status)`` is true, return the integer parameter to the
3806-
:manpage:`exit(2)` system call. Otherwise, the return value is meaningless.
3814+
Return the process exit status.
3815+
3816+
This function should be employed only if :func:`WIFEXITED` is true.
38073817

38083818
.. availability:: Unix.
38093819

@@ -3812,12 +3822,16 @@ used to determine the disposition of a process.
38123822

38133823
Return the signal which caused the process to stop.
38143824

3825+
This function should be employed only if :func:`WIFSTOPPED` is true.
3826+
38153827
.. availability:: Unix.
38163828

38173829

38183830
.. function:: WTERMSIG(status)
38193831

3820-
Return the signal which caused the process to exit.
3832+
Return the number of the signal that caused the process to terminate.
3833+
3834+
This function should be employed only if :func:`WIFSIGNALED` is true.
38213835

38223836
.. availability:: Unix.
38233837

0 commit comments

Comments
 (0)