From d61b2ed0a3f7c8647fbf0b912c66711e95fc9127 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 22 Nov 2016 16:50:08 -0800 Subject: [PATCH] Support script interpreters for async_wrapper. (#18592) --- lib/ansible/plugins/action/async.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/action/async.py b/lib/ansible/plugins/action/async.py index e4c67371a1c..e7c5661852d 100644 --- a/lib/ansible/plugins/action/async.py +++ b/lib/ansible/plugins/action/async.py @@ -89,7 +89,15 @@ class ActionModule(ActionBase): async_limit = self._task.async async_jid = str(random.randint(0, 999999999999)) - async_cmd = [env_string, remote_async_module_path, async_jid, async_limit, remote_module_path] + # call the interpreter for async_wrapper directly + # this permits use of a script for an interpreter on non-Linux platforms + # TODO: re-implement async_wrapper as a regular module to avoid this special case + interpreter = shebang.replace('#!', '').strip() + async_cmd = [interpreter, remote_async_module_path, async_jid, async_limit, remote_module_path] + + if env_string: + async_cmd.insert(0, env_string) + if argsfile: async_cmd.append(argsfile) else: