From 15498667539e2bbe2747266f4496ae0af1307056 Mon Sep 17 00:00:00 2001 From: _Trizion_ Date: Tue, 20 Aug 2024 15:54:16 +0200 Subject: [PATCH] Change from warning to error and return early --- FABulous/FABulous.py | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/FABulous/FABulous.py b/FABulous/FABulous.py index 49d9e3a0..d7aa5c99 100644 --- a/FABulous/FABulous.py +++ b/FABulous/FABulous.py @@ -889,30 +889,34 @@ def do_start_FABulator(self, *ignored): """ logger.info("Checking for FABulator installation") fabulatorRoot = os.getenv("FABULATOR_ROOT") + if fabulatorRoot is None: logger.warning("FABULATOR_ROOT environment variable not set.") logger.warning( "Install FABulator and set the FABULATOR_ROOT environment variable to use this feature." ) - elif not os.path.exists(fabulatorRoot): - logger.warning( + return + + if not os.path.exists(fabulatorRoot): + logger.error( f"FABULATOR_ROOT environment variable set to {fabulatorRoot} but the directory does not exist." ) - else: - logger.info(f"Found FABulator installation at {fabulatorRoot}") - logger.info(f"Trying to start FABulator...") + return - startupCmd = ["mvn", "-f", f"{fabulatorRoot}/pom.xml", "javafx:run"] - try: - if self.verbose: - # log FABulator output to the FABulous shell - sp.Popen(startupCmd) - else: - # discard FABulator output - sp.Popen(startupCmd, stdout=sp.DEVNULL, stderr=sp.DEVNULL) - - except sp.SubprocessError: - logger.error("Startup of FABulator failed.") + logger.info(f"Found FABulator installation at {fabulatorRoot}") + logger.info(f"Trying to start FABulator...") + + startupCmd = ["mvn", "-f", f"{fabulatorRoot}/pom.xml", "javafx:run"] + try: + if self.verbose: + # log FABulator output to the FABulous shell + sp.Popen(startupCmd) + else: + # discard FABulator output + sp.Popen(startupCmd, stdout=sp.DEVNULL, stderr=sp.DEVNULL) + + except sp.SubprocessError: + logger.error("Startup of FABulator failed.") def do_gen_bitStream_spec(self, *ignored): """Generates bitstream specification of the fabric by calling