Skip to content
This repository was archived by the owner on Mar 28, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions pyFG/fortios.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,25 @@ def execute_command(self, command):

error = ''
output = ''
for e in error_chan.read():
error = error + self._read_wrapper(e)
try:
for e in error_chan.read():
error = error + self._read_wrapper(e)
except:
pass

_buf = ""
_bufcnt = 0
_bufmaxlength = 2048

for o in output_chan.read():
output = output + self._read_wrapper(o)
_buf = _buf + self._read_wrapper(o)
_bufcnt += 1
if _bufcnt > _bufmaxlength:
output = output + _buf
_buf = ""
_bufcnt = 0
if _bufcnt > 0:
output = output + _buf

if len(error) > 0:
msg = '%s %s:\n%s\n%s' % (err_msg, self.ssh.get_host_keys().keys()[0], command, error)
Expand Down