From 80baa8b5aca9f1de996007b92f6b6b3e42e6f877 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Tue, 15 Nov 2022 07:25:35 +0530 Subject: cerbero: Return an error when download fails on powershell The &{ } construct we were using for chaining commands actually eats the exit code of the last command. Turns out we don't actually need that construct at all to chain commands. Part-of: --- cerbero/utils/shell.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cerbero/utils/shell.py b/cerbero/utils/shell.py index 1e9260ad..995ae759 100644 --- a/cerbero/utils/shell.py +++ b/cerbero/utils/shell.py @@ -387,10 +387,10 @@ async def download(url, dest, check_cert=True, overwrite=False, logfile=None, mi urls += [urllib.parse.urljoin(u + '/', filename) for u in mirrors] if sys.platform.startswith('win'): - cmd = ['powershell', '-Command', '& { Set-Variable -Name ' \ + cmd = ['powershell', '-Command', 'Set-Variable -Name ' \ 'ProgressPreference -Value \'SilentlyContinue\'; ' \ f'Invoke-WebRequest -UserAgent {user_agent} -OutFile {dest} ' \ - '-Method Get -Uri %s }'] + '-Method Get -Uri %s'] elif which('wget'): cmd = ['wget', '--user-agent', user_agent, '--tries=2', '--timeout=20', '--progress=dot:giga', '-O', dest] -- cgit v1.2.3