@@ -486,6 +486,13 @@ def _make_output_readers(self, channel, stdout_buffer, stderr_buffer):
486
486
raise NotImplementedError
487
487
488
488
def execute (self , cmd , use_pty = False , channel = None ):
489
+ """
490
+ Deprecated - use ``run_command`` instead which returns a ``HostOutput`` object.
491
+ """
492
+ warn ("Deprecated - use run_command instead." , DeprecationWarning )
493
+ return self ._execute (cmd , use_pty = use_pty , channel = channel )
494
+
495
+ def _execute (self , cmd , use_pty = False , channel = None ):
489
496
raise NotImplementedError
490
497
491
498
def read_stderr (self , stderr_buffer , timeout = None ):
@@ -620,7 +627,7 @@ def run_command(self, command, sudo=False, user=None,
620
627
_command += "%s '%s'" % (_shell , command ,)
621
628
_command = _command .encode (encoding )
622
629
with GTimeout (seconds = self .timeout ):
623
- channel = self .execute (_command , use_pty = use_pty )
630
+ channel = self ._execute (_command , use_pty = use_pty )
624
631
_timeout = read_timeout if read_timeout else timeout
625
632
host_out = self ._make_host_output (channel , encoding , _timeout )
626
633
return host_out
0 commit comments