Skip to content

Commit 267afc2

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

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
@@ -4128,45 +4128,55 @@ used to determine the disposition of a process.
41284128
Return ``True`` if a core dump was generated for the process, otherwise
41294129
return ``False``.
41304130

4131+
This function should be employed only if :func:`WIFSIGNALED` is true.
4132+
41314133
.. availability:: Unix.
41324134

41334135

41344136
.. function:: WIFCONTINUED(status)
41354137

4136-
Return ``True`` if the process has been continued from a job control stop,
4137-
otherwise return ``False``.
4138+
Return ``True`` if a stopped child has been resumed by delivery of
4139+
:data:`~signal.SIGCONT` (if the process has been continued from a job
4140+
control stop), otherwise return ``False``.
4141+
4142+
See :data:`WCONTINUED` option.
41384143

41394144
.. availability:: Unix.
41404145

41414146

41424147
.. function:: WIFSTOPPED(status)
41434148

4144-
Return ``True`` if the process has been stopped, otherwise return
4145-
``False``.
4149+
Return ``True`` if the process was stopped by delivery of a signal,
4150+
otherwise return ``False``.
41464151

4147-
.. availability:: Unix.
4152+
:func:`WIFSTOPPED` only returns ``True`` if the :func:`waitpid` call was
4153+
done using :data:`WUNTRACED` option or when the process is being traced (see
4154+
:manpage:`ptrace(2)`).
41484155

4156+
.. availability:: Unix.
41494157

41504158
.. function:: WIFSIGNALED(status)
41514159

4152-
Return ``True`` if the process exited due to a signal, otherwise return
4160+
Return ``True`` if the process was terminated by a signal, otherwise return
41534161
``False``.
41544162

41554163
.. availability:: Unix.
41564164

41574165

41584166
.. function:: WIFEXITED(status)
41594167

4160-
Return ``True`` if the process exited using the :manpage:`exit(2)` system call,
4168+
Return ``True`` if the process exited terminated normally, that is,
4169+
by calling ``exit()`` or ``_exit()``, or by returning from ``main()``;
41614170
otherwise return ``False``.
41624171

41634172
.. availability:: Unix.
41644173

41654174

41664175
.. function:: WEXITSTATUS(status)
41674176

4168-
If ``WIFEXITED(status)`` is true, return the integer parameter to the
4169-
:manpage:`exit(2)` system call. Otherwise, the return value is meaningless.
4177+
Return the process exit status.
4178+
4179+
This function should be employed only if :func:`WIFEXITED` is true.
41704180

41714181
.. availability:: Unix.
41724182

@@ -4175,12 +4185,16 @@ used to determine the disposition of a process.
41754185

41764186
Return the signal which caused the process to stop.
41774187

4188+
This function should be employed only if :func:`WIFSTOPPED` is true.
4189+
41784190
.. availability:: Unix.
41794191

41804192

41814193
.. function:: WTERMSIG(status)
41824194

4183-
Return the signal which caused the process to exit.
4195+
Return the number of the signal that caused the process to terminate.
4196+
4197+
This function should be employed only if :func:`WIFSIGNALED` is true.
41844198

41854199
.. availability:: Unix.
41864200

0 commit comments

Comments
 (0)