From 2623e69db362b357db45c343e6d504909552c2d5 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Tue, 26 Apr 2022 13:33:59 +0100 Subject: [PATCH] runfvp: check for telnet Check for telnet on startup to avoid mysterious failures later when telnet isn't available. Signed-off-by: Ross Burton Signed-off-by: Jon Mason --- scripts/runfvp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/runfvp b/scripts/runfvp index 5cab0949..0ebf873e 100755 --- a/scripts/runfvp +++ b/scripts/runfvp @@ -5,6 +5,7 @@ import collections import json import os import re +import shutil import signal import sys import subprocess @@ -42,7 +43,7 @@ class Terminals: return config.get("RunFVP", "Terminal", fallback=None) def preferred_terminal(self) -> str: - import shlex, shutil + import shlex preferred = self.configured_terminal() if preferred: @@ -233,6 +234,11 @@ def runfvp(cli_args): cli.extend(fvp_args) logger.debug(f"Constructed FVP call: {cli}") + # Check that telnet is present + if not bool(shutil.which("telnet")): + logger.error("Cannot find telnet, this is needed to connect to the FVP.") + return 1 + if args.console: expected_terminal = config["console"] if not expected_terminal: