From ed1182f52cd4d17ee3df8f733fcd1509538aed6d Mon Sep 17 00:00:00 2001 From: qiujiacai Date: Sat, 7 Oct 2023 14:00:28 +0800 Subject: [PATCH] add error handling when download fails --- pyporter/pyporter.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyporter/pyporter.py b/pyporter/pyporter.py index 04b1998..aa219c7 100755 --- a/pyporter/pyporter.py +++ b/pyporter/pyporter.py @@ -348,7 +348,13 @@ def download_source(porter, tgtpath): if s_info.get("md5") == _hash: print("same source file exists, skip") return True - return subprocess.call(["wget", s_url, "-P", tgtpath]) + + try: + subprocess.call(["wget", s_url, "-P", tgtpath]) + return True + except Exception as e: + print(f"Failed to download source: {str(e)}") + return False def prepare_rpm_build_env(root): -- Gitee