diff mbox series

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

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

Commit Message

Clément Péron March 29, 2023, noon 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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Peter Hoyes March 29, 2023, 3:42 p.m. UTC | #1
On 29/03/2023 13:00, Clément Péron via lists.yoctoproject.org wrote:
> 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>
Reviewed-by: Peter Hoyes <peter.hoyes@arm.com>
> ---
>   scripts/runfvp | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/runfvp b/scripts/runfvp
> index c5a74b2f..ee60486c 100755
> --- a/scripts/runfvp
> +++ b/scripts/runfvp
> @@ -55,8 +55,8 @@ async def start_fvp(args, config, extra_args):
>   
>           if args.console:
>               fvp.add_line_callback(lambda line: logger.debug(f"FVP output: {line}"))
> -            expected_terminal = config["consoles"]["default"]
> -            if not expected_terminal:
> +            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
>               telnet = await fvp.create_telnet(expected_terminal)
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#4496): https://lists.yoctoproject.org/g/meta-arm/message/4496
> Mute This Topic: https://lists.yoctoproject.org/mt/97926510/5715260
> Group Owner: meta-arm+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/meta-arm/unsub [peter.hoyes@arm.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/scripts/runfvp b/scripts/runfvp
index c5a74b2f..ee60486c 100755
--- a/scripts/runfvp
+++ b/scripts/runfvp
@@ -55,8 +55,8 @@  async def start_fvp(args, config, extra_args):
 
         if args.console:
             fvp.add_line_callback(lambda line: logger.debug(f"FVP output: {line}"))
-            expected_terminal = config["consoles"]["default"]
-            if not expected_terminal:
+            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
             telnet = await fvp.create_telnet(expected_terminal)