Fix return value check for subprocess.run (#10972)

Subprocess.run does not return an integer.

Regressed in #10944
This commit is contained in:
Aarni Koskela authored and GitHub committed 2023-02-13 17:38:27 +04:00
1 parent fa4bdbe14d
commit 1a2eb532ce
1 file changed
+2 -2
+2 -2
View File
@@ -631,8 +631,8 @@ def download(url, dir='.', unzip=True, delete=True, curl=False, threads=1, retry
for i in range(retry + 1):
if curl:
s = 'sS' if threads > 1 else '' # silent
r = subprocess.run(f'curl -# -{s}L "{url}" -o "{f}" --retry 9 -C -'.split())
success = r == 0
proc = subprocess.run(f'curl -# -{s}L "{url}" -o "{f}" --retry 9 -C -'.split())
success = proc.returncode == 0
else:
torch.hub.download_url_to_file(url, f, progress=threads == 1) # torch download
success = f.is_file()