mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Do not use universal_newlines in subprocess.
This commit is contained in:
parent
d97ba11728
commit
183a6aed44
@ -716,10 +716,10 @@ class VirtualBox(IModule):
|
||||
"""
|
||||
|
||||
try:
|
||||
result = subprocess.check_output(command, stderr=subprocess.STDOUT, universal_newlines=True, timeout=30)
|
||||
result = subprocess.check_output(command, stderr=subprocess.STDOUT, timeout=30)
|
||||
except subprocess.SubprocessError as e:
|
||||
raise VirtualBoxError("Could not execute VBoxManage {}".format(e))
|
||||
return result
|
||||
return result.decode("utf-8")
|
||||
|
||||
@IModule.route("virtualbox.vm_list")
|
||||
def vm_list(self, request):
|
||||
|
@ -550,17 +550,17 @@ class VirtualBoxVM(object):
|
||||
command.extend(args)
|
||||
log.debug("Execute vboxmanage command: {}".format(command))
|
||||
try:
|
||||
result = subprocess.check_output(command, stderr=subprocess.STDOUT, universal_newlines=True, timeout=timeout)
|
||||
result = subprocess.check_output(command, stderr=subprocess.STDOUT, timeout=timeout)
|
||||
except subprocess.CalledProcessError as e:
|
||||
if e.output:
|
||||
# only the first line of the output is useful
|
||||
virtualbox_error = e.output.splitlines()[0]
|
||||
virtualbox_error = e.output.decode("utf-8").splitlines()[0]
|
||||
raise VirtualBoxError("{}".format(virtualbox_error))
|
||||
else:
|
||||
raise VirtualBoxError("{}".format(e))
|
||||
except subprocess.SubprocessError as e:
|
||||
raise VirtualBoxError("Could not execute VBoxManage: {}".format(e))
|
||||
return result.splitlines()
|
||||
return result.decode("utf-8").splitlines()
|
||||
|
||||
def _get_vm_info(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user