mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Execute commands through accelerate with shell when needed
This fixes an issue related to the new run_command changes, whereby Popen fails to run a command when an executable is specified + shell=False and there are multiple positional arguments (see Popen docs for details)
This commit is contained in:
parent
d686a23b69
commit
0556c53f78
1 changed files with 7 additions and 3 deletions
|
@ -329,11 +329,15 @@ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
|
|||
return dict(failed=True, msg='internal error: cmd is required')
|
||||
if 'tmp_path' not in data:
|
||||
return dict(failed=True, msg='internal error: tmp_path is required')
|
||||
if 'executable' not in data:
|
||||
return dict(failed=True, msg='internal error: executable is required')
|
||||
|
||||
vvvv("executing: %s" % data['cmd'])
|
||||
rc, stdout, stderr = self.server.module.run_command(data['cmd'], executable=data['executable'], close_fds=True)
|
||||
|
||||
use_unsafe_shell = False
|
||||
executable = data.get('executable')
|
||||
if executable:
|
||||
use_unsafe_shell = True
|
||||
|
||||
rc, stdout, stderr = self.server.module.run_command(data['cmd'], executable=executable, use_unsafe_shell=use_unsafe_shell)
|
||||
if stdout is None:
|
||||
stdout = ''
|
||||
if stderr is None:
|
||||
|
|
Loading…
Reference in a new issue