@@ -57,11 +57,14 @@ class HostOutput(object):
5757 __slots__ = ('host' , 'channel' , 'stdin' ,
5858 'client' , 'alias' , 'exception' ,
5959 'encoding' , 'read_timeout' , 'buffers' ,
60+ 'fully_qualified_command' ,
6061 )
6162
6263 def __init__ (self , host , channel , stdin ,
6364 client , alias = None , exception = None , encoding = 'utf-8' , read_timeout = None ,
64- buffers = None ):
65+ buffers = None ,
66+ fully_qualified_command = None ,
67+ ):
6568 """
6669 :param host: Host name output is for
6770 :type host: str
@@ -79,6 +82,15 @@ def __init__(self, host, channel, stdin,
7982 :type read_timeout: float
8083 :param buffers: Host buffer data.
8184 :type buffers: :py:class:`HostOutputBuffers`
85+ :param fully_qualified_command: The fully qualified command after any per-host argument substitution and
86+ including command string substitution required for executing via sudo or user-switching via 'su -c', using
87+ any specified shell on `run_command` *and* conversion to bytes via provided encoding.
88+ The fully_qualified_command is therefor a bytes object that can be saved or otherwise used anywhere bytes can
89+ be used without conversion.
90+ Use `fully_qualified_command.decode(encoding)` to decode with the encoding used for the equivalent host
91+ output object.
92+ Always `None` on `HostOutput` from interactive shells.
93+ :type fully_qualified_command: bytes
8294 """
8395 self .host = host
8496 self .channel = channel
@@ -89,6 +101,7 @@ def __init__(self, host, channel, stdin,
89101 self .encoding = encoding
90102 self .read_timeout = read_timeout
91103 self .buffers = buffers
104+ self .fully_qualified_command = fully_qualified_command
92105
93106 @property
94107 def stdout (self ):
@@ -125,10 +138,12 @@ def __repr__(self):
125138 "\t channel={channel}{linesep}" \
126139 "\t exception={exception}{linesep}" \
127140 "\t encoding={encoding}{linesep}" \
128- "\t read_timeout={read_timeout}" .format (
141+ "\t read_timeout={read_timeout}{linesep}" \
142+ "\t fully_qualified_command={fully_qualified_command}" .format (
129143 host = self .host , alias = self .alias , channel = self .channel ,
130144 exception = self .exception , linesep = linesep ,
131145 exit_code = self .exit_code , encoding = self .encoding , read_timeout = self .read_timeout ,
146+ fully_qualified_command = self .fully_qualified_command ,
132147 )
133148
134149 def __str__ (self ):
0 commit comments