Commit 94963290 by James Cammarata

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

Fix localhost tasks with complex executables
parents d0a11597 a5507275
...@@ -53,15 +53,16 @@ class Connection(object): ...@@ -53,15 +53,16 @@ class Connection(object):
if not self.runner.sudo or not sudoable: if not self.runner.sudo or not sudoable:
if executable: if executable:
local_cmd = [executable, '-c', cmd] local_cmd = executable.split() + ['-c', cmd]
else: else:
local_cmd = cmd local_cmd = cmd
else: else:
local_cmd, prompt, success_key = utils.make_sudo_cmd(sudo_user, executable, cmd) 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) vvv("EXEC %s" % (local_cmd), host=self.host)
p = subprocess.Popen(local_cmd, shell=isinstance(local_cmd, basestring), 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, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout=subprocess.PIPE, stderr=subprocess.PIPE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment