summaryrefslogtreecommitdiffstats
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2019-06-24 15:42:54 (GMT)
committerGitHub <noreply@github.com>2019-06-24 15:42:54 (GMT)
commit60419a7e96577cf783b3b45bf3984f9fb0d7ddff (patch)
tree2718cb915663c42902621491ba60accce6729d42 /Lib/subprocess.py
parent9bbf4d7083a819cbcee2a6cd3df2802d4c50f734 (diff)
downloadcpython-60419a7e96577cf783b3b45bf3984f9fb0d7ddff.zip
cpython-60419a7e96577cf783b3b45bf3984f9fb0d7ddff.tar.gz
cpython-60419a7e96577cf783b3b45bf3984f9fb0d7ddff.tar.bz2
bpo-37363: Add audit events for a range of modules (GH-14301)
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r--Lib/subprocess.py9
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