### Summary

ansible-core 2.14.3 and 2.14.5 work flawlessly.

ansible-core 2.15.0 does not — the [command](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/command_module.html) and [shell](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/shell_module.html) modules never return in situations like those described here:

- iiab/iiab#3588

This has been confirmed on both Debian 11 (x86_64 VM) and 64-bit Raspberry Pi OS (Raspberry Pi 400).

Here's an example of ansible 2.15.0 freezing — as a result of the `./start_asterisk start` command (which works perfectly at the command-line, but no longer with ansible 2.15.0) never returning:

![image](https://github.com/ansible/ansible/assets/2458907/f8a0d89b-f038-4730-93d1-f6a0771fc9d7)

### Issue Type

Bug Report

### Component Name

command, shell

### Ansible Version

```console
$ ansible --version    # BAD VERSION

ansible [core 2.15.0]
  config file = /opt/iiab/iiab/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/ansible/lib/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] (/usr/local/ansible/bin/python3)
  jinja version = 3.1.2
  libyaml = True

$ ansible --version    # GOOD VERSION

ansible [core 2.14.5]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/ansible/lib/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] (/usr/local/ansible/bin/python3)
  jinja version = 3.1.2
  libyaml = True

$ ansible --version    # GOOD VERSION

ansible [core 2.14.3]
  config file = /opt/iiab/iiab/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/ansible/lib/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] (/usr/local/ansible/bin/python3)
  jinja version = 3.1.2
  libyaml = True
```


### Configuration

```console
$ ansible-config dump --only-changed -t all

CONFIG_FILE() = /opt/iiab/iiab/ansible.cfg
INTERPRETER_PYTHON(/opt/iiab/iiab/ansible.cfg) = /usr/bin/python3

$ cat /opt/iiab/iiab/ansible.cfg

[defaults]
interpreter_python=/usr/bin/python3
```


### OS / Environment

This has been confirmed on both Debian 11 (x86_64 VM) and 64-bit Raspberry Pi OS (Raspberry Pi 400).

### Steps to Reproduce

Install Asterisk and then FreePBX onto Debian 11 as follows:

- https://github.com/iiab/iiab/blob/master/roles/pbx/tasks/asterisk.yml
- https://github.com/iiab/iiab/blob/master/roles/pbx/tasks/freepbx.yml

CLARIF: PHP 7.4 is required, so newer OS's will not work here.

### Expected Results

Running the exact same command at the prompt (Linux command-line) works.

Ansible should not freeze (the command or shell module never complete with 2.15.0 — unlike with 2.14.x).

### Actual Results

Unfortunately there's no error message, as ansible-core 2.15.0 freezes.

Whereas 2.14.3 and 2.14.5 work perfectly.

Please see details at:

- iiab/iiab#3588


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
get_platform_subclass,
)
from ansible.module_utils.pycompat24 import get_exception, literal_eval
from ansible.module_utils.common.parameters import (
    env_fallback,
    remove_values,
    sanitize_keys,
    DEFAULT_TYPE_VALIDATORS,
    PASS_VARS,
    PASS_BOOLS,
)
from ansible.module_utils.errors import AnsibleFallbackNotFound, AnsibleValidationErrorMultiple, UnsupportedError
from ansible.module_utils.six import (
    PY2,
    PY3,
    b,
    binary_type,
    integer_types,
    iteritems,
    string_types,
    text_type,
)
from ansible.module_utils.six.moves import map, reduce, shlex_quote
from ansible.module_utils.common.validation import (
    check_missing_parameters,
    safe_eval,
)
from ansible.module_utils.common._utils import get_all_subclasses as _get_all_subclasses
from ansible.module_utils.parsing.convert_bool import BOOLEANS, BOOLEANS_FALSE, BOOLEANS_TRUE, boolean
from ansible.module_utils.common.warnings import (