From 4b4235e9f61b9a30ddfe083eaf12f6e47511df87 Mon Sep 17 00:00:00 2001 From: lixin Date: Tue, 11 Apr 2023 16:24:11 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=B0=86=E7=BC=93=E5=AD=98=E6=B8=85?= =?UTF-8?q?=E7=90=86=E4=BF=AE=E6=94=B9=E4=B8=BA=E9=9D=99=E6=80=81=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- abicheck/binhandler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/abicheck/binhandler.py b/abicheck/binhandler.py index 26211ea..9d0b569 100644 --- a/abicheck/binhandler.py +++ b/abicheck/binhandler.py @@ -639,7 +639,8 @@ class ABI: html_file = os.path.join(self.output_dir, self.EXPORT_HTML_FILE) self.logger.info(f"The check result is {os.path.abspath(html_file)}") - def clean_cache(self): + @staticmethod + def clean_cache(): cache_dir = '/tmp/abi-info-check-cache' if os.path.exists(cache_dir): shutil.rmtree(cache_dir) -- Gitee From de46bcb7b2d0a9bdaefaec73d002041039241d53 Mon Sep 17 00:00:00 2001 From: lixin Date: Tue, 11 Apr 2023 16:36:34 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=9B=E7=A8=8B?= =?UTF-8?q?=E4=B8=AD=E6=96=AD=EF=BC=8C=E7=BC=93=E5=AD=98=E6=9C=AA=E6=B8=85?= =?UTF-8?q?=E7=90=86=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- abicheck/main.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/abicheck/main.py b/abicheck/main.py index e8a5e41..56a68e8 100644 --- a/abicheck/main.py +++ b/abicheck/main.py @@ -14,6 +14,7 @@ # along with this program. If not, see . import logging +import signal import sys import os @@ -75,9 +76,15 @@ def main(): # show result checker.show_html() - checker.clean_cache() + +def sigint_handler(sig, frame): + print('You pressed Ctrl+C!') + binhandler.ABI.clean_cache() + sys.exit(0) if __name__ == "__main__": + binhandler.ABI.clean_cache() + signal.signal(signal.SIGINT, sigint_handler) sys.exit(main()) -- Gitee