How to use the aexpect.ShellCmdError function in aexpect

To help you get started, we’ve selected a few aexpect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github avocado-framework / avocado-vt / virttest / utils_net.py View on Github external
def _process_output(cmd, reg_pattern):
        sys_ifname = ["lo", "sit0", "virbr0"]
        try:
            output = session.cmd_output_safe(cmd)
            ifname_list = re.findall(reg_pattern, output, re.I)
            if not ifname_list:
                return None
            if mac_address:
                return ifname_list[0]
            for ifname in sys_ifname:
                if ifname in ifname_list:
                    ifname_list.remove(ifname)
            return ifname_list
        except aexpect.ShellCmdError:
            return None
github avocado-framework / avocado-vt / virttest / utils_spice.py View on Github external
pgrep_process = "'^gdm$'"
    else:
        command = "Xorg"
        pgrep_process = "Xorg"

    try:
        pid = session.cmd("pgrep %s" % pgrep_process)
        session.cmd("killall %s" % command)
        utils_misc.wait_for(lambda: _is_pid_alive(session, pid), 10,
                            timeout, 0.2)
    except Exception:
        pass

    try:
        session.cmd("ps -C %s" % command)
    except ShellCmdError:
        raise exceptions.TestFail("X/gdm not running")