Skip to content

Commit 0d80083

Browse files
committed
fixed #14665 - donate-cpu-server.py: improved handling of corrupt package-index.txt
1 parent caff3d4 commit 0d80083

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tools/donate-cpu-server.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
2727
# Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
2828
# changes)
29-
SERVER_VERSION = "1.3.68"
29+
SERVER_VERSION = "1.3.69"
3030

3131
# TODO: fetch from GitHub tags
3232
OLD_VERSION = '2.20.0'
@@ -1612,7 +1612,11 @@ def server(server_address_port: int, packages: list, packageIndex: int, resultPa
16121612
packageIndex = 0
16131613
if os.path.isfile('package-index.txt'):
16141614
with open('package-index.txt', 'rt') as f:
1615-
packageIndex = int(f.read())
1615+
# TODO: the file might be empty - fixture out how this might happen
1616+
try:
1617+
packageIndex = int(f.read())
1618+
except ValueError as e:
1619+
logging.error("failed to convert package index to int", e)
16161620
if packageIndex < 0 or packageIndex >= len(packages):
16171621
packageIndex = 0
16181622

0 commit comments

Comments
 (0)