From 8f2d21f794321def1fa8aa3aa6812c89dc145579 Mon Sep 17 00:00:00 2001 From: Kingtous Date: Fri, 2 Dec 2022 11:41:22 +0800 Subject: [PATCH] opt: add build wrap in build.py --- build.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build.py b/build.py index fc62f8ecb..56361ba0b 100755 --- a/build.py +++ b/build.py @@ -8,6 +8,7 @@ import urllib.request import shutil import hashlib import argparse +import sys windows = platform.platform().startswith('Windows') osx = platform.platform().startswith( @@ -17,6 +18,14 @@ exe_path = 'target/release/' + hbb_name flutter_win_target_dir = 'flutter/build/windows/runner/Release/' skip_cargo = False +def custom_os_system(cmd): + err = os._system(cmd) + if err != 0: + print(f"Error occured when executing: {cmd}. Exiting.") + sys.exit(-1) +# replace prebuilt os.system +os._system = os.system +os.system = custom_os_system def get_version(): with open("Cargo.toml", encoding="utf-8") as fh: