diff mbox series

[v2,2/2] scripts/runfvp: Fix KeyError exception when there is no FVP_CONSOLE provided

Message ID 20230406152908.224075-2-peron.clem@gmail.com
State New
Headers show
Series [v2,1/2] arm/lib: pass the PATH to fvp runner | expand

Commit Message

Clément Péron April 6, 2023, 3:29 p.m. UTC
We access the dictionnary element that doesn't exist.

Use the get() method instead that will default the element to None if it
doesn't exist.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
 scripts/runfvp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series


diff --git a/scripts/runfvp b/scripts/runfvp
index 939352b5..bfd60d71 100755
--- a/scripts/runfvp
+++ b/scripts/runfvp
@@ -55,8 +55,9 @@  def start_fvp(args, config, extra_args):
         fvp.start(config, extra_args, args.terminals)
         if args.console:
-            expected_terminal = config["consoles"]["default"]
-            if not expected_terminal:
+            fvp.add_line_callback(lambda line: logger.debug(f"FVP output: {line}"))
+            expected_terminal = config["consoles"].get("default")
+            if expected_terminal is None:
                 logger.error("--console used but FVP_CONSOLE not set in machine configuration")
                 return 1
             port_stdout, log_stdout = itertools.tee(fvp.stdout, 2)