All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Clément Péron" <peron.clem@gmail.com>
To: meta-arm@lists.yoctoproject.org
Cc: "Clément Péron" <peron.clem@gmail.com>
Subject: [PATCH v2 2/2] scripts/runfvp: Fix KeyError exception when there is no FVP_CONSOLE provided
Date: Thu,  6 Apr 2023 17:29:08 +0200	[thread overview]
Message-ID: <20230406152908.224075-2-peron.clem@gmail.com> (raw)
In-Reply-To: <20230406152908.224075-1-peron.clem@gmail.com>

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 --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)
-- 
2.34.1



  reply	other threads:[~2023-04-06 15:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06 15:29 [PATCH v2 1/2] arm/lib: pass the PATH to fvp runner Clément Péron
2023-04-06 15:29 ` Clément Péron [this message]
     [not found] ` <1753621D8383E1DE.3977@lists.yoctoproject.org>
2023-04-08  8:13   ` [meta-arm] [PATCH v2 2/2] scripts/runfvp: Fix KeyError exception when there is no FVP_CONSOLE provided Clément Péron
2023-05-25  0:51 ` [PATCH v2 1/2] arm/lib: pass the PATH to fvp runner Jon Mason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230406152908.224075-2-peron.clem@gmail.com \
    --to=peron.clem@gmail.com \
    --cc=meta-arm@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.