#908: Trying to fix a bug when obteining execution outputs.
parent
16c3792567
commit
2ac6daa3f5
|
@ -156,8 +156,7 @@ class OpenGnSysWorker(ServerWorker):
|
|||
route = route[len(self.REST.endpoint):]
|
||||
# Send back exit status and outputs (base64-encoded)
|
||||
self.REST.sendMessage(route, {'mac': self.interface.mac, 'ip': self.interface.ip, 'trace': op_id,
|
||||
'status': stat, 'output': out.encode('utf8').encode('base64'),
|
||||
'error': err.encode('utf8').encode('base64')})
|
||||
'status': stat, 'output': out.encode('base64'), 'error': err.encode('base64')})
|
||||
# Show latest menu, if OGAgent runs on ogLive
|
||||
if os_type == 'oglive':
|
||||
# Send configuration data, if needed
|
||||
|
|
|
@ -39,6 +39,7 @@ import subprocess
|
|||
import struct
|
||||
import array
|
||||
import six
|
||||
import chardet
|
||||
from opengnsys import utils
|
||||
|
||||
|
||||
|
@ -209,7 +210,8 @@ def exec_command(cmd):
|
|||
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
(out, err) = proc.communicate()
|
||||
stat = proc.returncode
|
||||
return stat, out, err
|
||||
return stat, out.decode(chardet.detect(out)['encoding']).encode('utf8'),\
|
||||
err.decode(chardet.detect(err)['encoding']).encode('utf8')
|
||||
|
||||
|
||||
def get_hardware():
|
||||
|
|
Loading…
Reference in New Issue