def command_exist()

in fiosynth_lib/flash_config.py [0:0]


def command_exist(cmd):
    if cmd.split()[0] not in ["nvme", "flash_manager", "smartctl"]:
        return False
    args = shlex.split(cmd)
    try:
        subprocess.call(
            args, stdout=open(os.devnull, "wb"), stderr=open(os.devnull, "wb")
        )
    except OSError:
        print("%s command not installed" % cmd)
        return False
    test = cmdline(cmd)
    if test.decode("UTF-8") == "":
        return False
    else:
        return True