From 0ee1c3677918fd3eaa7b59a6d5e98c253049baa0 Mon Sep 17 00:00:00 2001 From: Matt Davis <6775756+nitzmahone@users.noreply.github.com> Date: Fri, 30 May 2025 14:39:45 -0700 Subject: [PATCH] local connection always passes str to Popen (#85239) --- changelogs/fragments/local_popen_text.yml | 2 ++ lib/ansible/plugins/connection/local.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/local_popen_text.yml diff --git a/changelogs/fragments/local_popen_text.yml b/changelogs/fragments/local_popen_text.yml new file mode 100644 index 00000000000..76053d2cdf0 --- /dev/null +++ b/changelogs/fragments/local_popen_text.yml @@ -0,0 +1,2 @@ +bugfixes: + - local connection plugin - The command-line used to create subprocesses is now always ``str`` to avoid issues with debuggers and profilers. diff --git a/lib/ansible/plugins/connection/local.py b/lib/ansible/plugins/connection/local.py index 934ef52738c..af5e8d66d00 100644 --- a/lib/ansible/plugins/connection/local.py +++ b/lib/ansible/plugins/connection/local.py @@ -101,9 +101,9 @@ class Connection(ConnectionBase): display.debug("opening command with Popen()") if isinstance(cmd, (text_type, binary_type)): - cmd = to_bytes(cmd) + cmd = to_text(cmd) else: - cmd = map(to_bytes, cmd) + cmd = map(to_text, cmd) pty_primary = None stdin = subprocess.PIPE