diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-06-24 16:09:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-24 16:09:47 (GMT) |
commit | 8763d43a9558b345af6a3a298afa18e7d3b42fd0 (patch) | |
tree | 260bf9be22b743195365c927df1e7ad709371568 /Lib/subprocess.py | |
parent | 366dac99c0c0c416a37874140696f59178db4e43 (diff) | |
download | cpython-8763d43a9558b345af6a3a298afa18e7d3b42fd0.zip cpython-8763d43a9558b345af6a3a298afa18e7d3b42fd0.tar.gz cpython-8763d43a9558b345af6a3a298afa18e7d3b42fd0.tar.bz2 |
bpo-37363: Add audit events for a range of modules (GH-14301)
(cherry picked from commit 60419a7e96577cf783b3b45bf3984f9fb0d7ddff)
Co-authored-by: Steve Dower <steve.dower@python.org>
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r-- | Lib/subprocess.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py index d34c578..c0bda96 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1268,6 +1268,11 @@ class Popen(object): comspec = os.environ.get("COMSPEC", "cmd.exe") args = '{} /c "{}"'.format (comspec, args) + if cwd is not None: + cwd = os.fsdecode(cwd) + + sys.audit("subprocess.Popen", executable, args, cwd, env) + # Start the process try: hp, ht, pid, tid = _winapi.CreateProcess(executable, args, @@ -1276,7 +1281,7 @@ class Popen(object): int(not close_fds), creationflags, env, - os.fsdecode(cwd) if cwd is not None else None, + cwd, startupinfo) finally: # Child is launched. Close the parent's copy of those pipe @@ -1543,6 +1548,8 @@ class Popen(object): if executable is None: executable = args[0] + sys.audit("subprocess.Popen", executable, args, cwd, env) + if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None |