[3.8] bpo-39184: Add audit events to command execution functions in os and pty modules (GH-17824) by miss-islington · Pull Request #18353 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Doc/library/os.rst
1 change: 1 addition & 0 deletions Doc/library/pty.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ The :mod:`pty` module defines the following functions:
*select* throws an error on your platform when passed three empty lists. This
is a bug, documented in `issue 26228 <https://bugs.python.org/issue26228>`_.

.. audit-event:: pty.spawn argv pty.spawn

.. versionchanged:: 3.4
:func:`spawn` now returns the status value from :func:`os.waitpid`
Expand Down
2 changes: 2 additions & 0 deletions Lib/pty.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from select import select
import os
import sys
import tty

__all__ = ["openpty","fork","spawn"]
Expand Down Expand Up @@ -151,6 +152,7 @@ def spawn(argv, master_read=_read, stdin_read=_read):
"""Create a spawned process."""
if type(argv) == type(''):
argv = (argv,)
sys.audit('pty.spawn', argv)
pid, master_fd = fork()
if pid == CHILD:
os.execlp(argv[0], *argv)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add audit events to command execution functions in os and pty modules.
49 changes: 42 additions & 7 deletions Modules/posixmodule.c