1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Force all args to strings for 'command' (fixes #43732)

This commit is contained in:
Andrew Gaffney 2018-08-06 14:46:40 -05:00 committed by Toshio Kuratomi
parent 9a8bae5b67
commit 9f9e936d3c

View file

@ -133,6 +133,8 @@ import os
import shlex
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native
from ansible.module_utils.common.collections import is_iterable
def check_command(module, commandline):
@ -215,6 +217,10 @@ def main():
args = args or argv
# All args must be strings
if is_iterable(args, include_strings=False):
args = [to_native(arg, errors='surrogate_or_strict', nonstring='simplerepr') for arg in args]
if chdir:
chdir = os.path.abspath(chdir)
os.chdir(chdir)