From 94fbd3fac9177ef33fef6937ca9c4f24643c3204 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 16 Jun 2015 15:46:12 +0200 Subject: [PATCH] Ignore invalid characters when reading the output of a process It should happend only when user try to use another binary and the code of VPCS, dynamips... Will detect it's not the correct binary. For example we detect this error after an user used SupperPutty instead of VPCS. Fix #235 --- gns3server/utils/asyncio.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gns3server/utils/asyncio.py b/gns3server/utils/asyncio.py index c84e0fbe..21d18a74 100644 --- a/gns3server/utils/asyncio.py +++ b/gns3server/utils/asyncio.py @@ -51,7 +51,10 @@ def subprocess_check_output(*args, cwd=None, env=None): output = yield from proc.stdout.read() if output is None: return "" - return output.decode("utf-8") + # If we received garbage we ignore invalid characters + # it should happend only when user try to use another binary + # and the code of VPCS, dynamips... Will detect it's not the correct binary + return output.decode("utf-8", errors="ignore") @asyncio.coroutine