From 77feec30a0b6e0fb60a9095ec0259201604b8a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20M=C3=A4der?= Date: Thu, 14 May 2020 16:02:03 +0200 Subject: [PATCH] Don't stop when startup_scripts quit Fixes #284 --- startup_scripts/__main__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/startup_scripts/__main__.py b/startup_scripts/__main__.py index b13b8dd..343ca95 100644 --- a/startup_scripts/__main__.py +++ b/startup_scripts/__main__.py @@ -13,6 +13,11 @@ with scandir(dirname(abspath(__file__))) as it: for f in sorted(it, key = filename): if f.name.startswith('__') or not f.is_file(): continue - - print(f"Running {f.path}") - runpy.run_path(f.path) + + print(f"▶️ Running the startup script {f.path}") + try: + runpy.run_path(f.path) + except SystemExit as e: + if e.code is not None and e.code != 0: + print(f"‼️ The startup script {f.path} returned with code {e.code}, exiting.") + raise