mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #6981 from aliles/fix-localhost-executable-with-flags
Fix localhost tasks with complex executables
This commit is contained in:
commit
94963290b9
1 changed files with 3 additions and 2 deletions
|
@ -53,15 +53,16 @@ class Connection(object):
|
|||
|
||||
if not self.runner.sudo or not sudoable:
|
||||
if executable:
|
||||
local_cmd = [executable, '-c', cmd]
|
||||
local_cmd = executable.split() + ['-c', cmd]
|
||||
else:
|
||||
local_cmd = cmd
|
||||
else:
|
||||
local_cmd, prompt, success_key = utils.make_sudo_cmd(sudo_user, executable, cmd)
|
||||
executable = executable.split()[0] if executable else None
|
||||
|
||||
vvv("EXEC %s" % (local_cmd), host=self.host)
|
||||
p = subprocess.Popen(local_cmd, shell=isinstance(local_cmd, basestring),
|
||||
cwd=self.runner.basedir, executable=executable or None,
|
||||
cwd=self.runner.basedir, executable=executable,
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue