summaryrefslogtreecommitdiffstats
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
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