From 6e6cdae20e74441babbd5f3a5519e8f5a507b186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Thu, 4 Apr 2019 13:09:35 +0200 Subject: [PATCH] donate-cpu.py: improved error handling when fetching cppcheck version (#1780) During a local scan it did not get any cppcheck versions causing the script to fail with an exception when creating the diff. --- tools/donate-cpu.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/donate-cpu.py b/tools/donate-cpu.py index 328423e1c..da7148658 100644 --- a/tools/donate-cpu.py +++ b/tools/donate-cpu.py @@ -40,7 +40,7 @@ import platform # Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/ # Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic # changes) -CLIENT_VERSION = "1.1.20" +CLIENT_VERSION = "1.1.21" def checkRequirements(): @@ -110,7 +110,8 @@ def getCppcheckVersions(server_address): sock.connect(server_address) sock.send(b'GetCppcheckVersions\n') versions = sock.recv(256) - except socket.error: + except socket.error as err: + print('Failed to get cppcheck versions: ' + str(err)) return None sock.close() return versions.decode('utf-8').split() @@ -519,6 +520,9 @@ while True: if cppcheckVersions is None: print('Failed to communicate with server, retry later') sys.exit(1) + if len(cppcheckVersions) == 0: + print('Did not get any cppcheck versions from server, retry later') + sys.exit(1) for ver in cppcheckVersions: if ver == 'head': if not compile(cppcheckPath, jobs):