Show More
@@ -190,6 +190,25 b' class server(object):' | |||||
190 |
|
190 | |||
191 | return data |
|
191 | return data | |
192 |
|
192 | |||
|
193 | def _readstr(self): | |||
|
194 | """read a string from the channel | |||
|
195 | ||||
|
196 | format: | |||
|
197 | data length (uint32), data | |||
|
198 | """ | |||
|
199 | length = struct.unpack('>I', self._read(4))[0] | |||
|
200 | if not length: | |||
|
201 | return '' | |||
|
202 | return self._read(length) | |||
|
203 | ||||
|
204 | def _readlist(self): | |||
|
205 | """read a list of NULL separated strings from the channel""" | |||
|
206 | s = self._readstr() | |||
|
207 | if s: | |||
|
208 | return s.split('\0') | |||
|
209 | else: | |||
|
210 | return [] | |||
|
211 | ||||
193 | def runcommand(self): |
|
212 | def runcommand(self): | |
194 | """ reads a list of \0 terminated arguments, executes |
|
213 | """ reads a list of \0 terminated arguments, executes | |
195 | and writes the return code to the result channel """ |
|
214 | and writes the return code to the result channel """ |
General Comments 0
You need to be logged in to leave comments.
Login now