Fixed for KeyboardInterrupt

This commit is contained in:
Dimitris Zlatanidis 2023-03-15 11:28:30 +02:00
parent afab65bfdd
commit b8e7977236
2 changed files with 16 additions and 10 deletions

View file

@ -5,6 +5,7 @@ Updated:
- Wget options, removed -N timestamping
Fixed:
- Summary for upgrade packages
- Downloader for KeyboardInterrupt
BugFixed:
- Default build path /tmp/slpkg/build

View file

@ -48,21 +48,26 @@ class Downloader(Configs, Utilities):
def tools(self, url: str) -> None:
""" Downloader tools wget, curl and lftp. """
output: int = 0
filename: str = url.split('/')[-1]
if self.downloader == 'wget':
output = subprocess.call(f'{self.downloader} {self.wget_options} --directory-prefix={self.path} '
f'"{url}"', shell=True)
try:
if self.downloader == 'wget':
output = subprocess.call(f'{self.downloader} {self.wget_options} --directory-prefix={self.path} '
f'"{url}"', shell=True)
elif self.downloader == 'curl':
output = subprocess.call(f'{self.downloader} {self.curl_options} "{url}" --output '
f'{self.path}/{filename}', shell=True)
elif self.downloader == 'curl':
output = subprocess.call(f'{self.downloader} {self.curl_options} "{url}" --output '
f'{self.path}/{filename}', shell=True)
elif self.downloader == 'lftp':
output = subprocess.call(f'lftp {self.lftp_get_options} {url} -o {self.path}', shell=True)
elif self.downloader == 'lftp':
output = subprocess.call(f'lftp {self.lftp_get_options} {url} -o {self.path}', shell=True)
else:
raise SystemExit(f"{self.red}Error:{self.endc} Downloader '{self.downloader}' not supported.\n")
else:
raise SystemExit(f"{self.red}Error:{self.endc} Downloader '{self.downloader}' not supported.\n")
except KeyboardInterrupt:
raise SystemExit(1)
if output != 0:
raise SystemExit(output)