Skip to content

Commit

Permalink
Change from warning to error and return early
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobTernes committed Aug 20, 2024
1 parent 36ebe12 commit 1549866
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions FABulous/FABulous.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1549866

Please sign in to comment.