Skip to content

Commit fa5aeab

Browse files
author
MarcoFalke
committed
test: Avoid duplicate curl call in get_previous_releases.py
1 parent 55d663c commit fa5aeab

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

test/get_previous_releases.py

+3-14
Original file line numberDiff line numberDiff line change
@@ -133,20 +133,9 @@ def download_binary(tag, args) -> int:
133133

134134
print('Fetching: {tarballUrl}'.format(tarballUrl=tarballUrl))
135135

136-
header, status = subprocess.Popen(
137-
['curl', '--head', tarballUrl], stdout=subprocess.PIPE).communicate()
138-
if re.search("404 Not Found", header.decode("utf-8")):
139-
print("Binary tag was not found")
140-
return 1
141-
142-
curlCmds = [
143-
['curl', '--remote-name', tarballUrl]
144-
]
145-
146-
for cmd in curlCmds:
147-
ret = subprocess.run(cmd).returncode
148-
if ret:
149-
return ret
136+
ret = subprocess.run(['curl', '--fail', '--remote-name', tarballUrl]).returncode
137+
if ret:
138+
return ret
150139

151140
hasher = hashlib.sha256()
152141
with open(tarball, "rb") as afile:

0 commit comments

Comments
 (0)