def _execute(self, cmd, **kwargs):
"""
Execute a command on a remote host.
Parameters
----------
cmd : string
Command to be executed on remote host.
kwargs : keywords
Options to pass to subprocess.Popen.
Returns
-------
proc : Popen subprocess
Subprocess used to run remote command.
"""
template = 'ssh {login} -T -o ControlPath={socket} << EOF\n{cmd}\nEOF'
config = dict(self._subprocess_config)
config.update(kwargs)
return run_in_subprocess(template.format(login=self._login_info,
socket=self._socket_path,
cmd=cmd),
check_output=True,
**config)
评论列表
文章目录