Merge pull request #6981 from aliles/fix-localhost-executable-with-flags

Fix localhost tasks with complex executables
This commit is contained in:
James Cammarata 2014-06-20 12:51:54 -05:00
commit 94963290b9

View file

@ -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)