From 94cc7a38c22faf519b6257324157cf839bf16ced Mon Sep 17 00:00:00 2001 From: qiujiacai Date: Mon, 16 Oct 2023 10:40:54 +0800 Subject: [PATCH] add error handling when download fails --- pyporter/pyporter.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pyporter/pyporter.py b/pyporter/pyporter.py index 04b1998..ff06d05 100755 --- a/pyporter/pyporter.py +++ b/pyporter/pyporter.py @@ -348,7 +348,12 @@ 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