def run_command_impl(self, node: mparser.BaseNode, args: T.Tuple[(T.Union[(build.Executable, ExternalProgram, compilers.Compiler, mesonlib.File, str)], T.List[T.Union[(build.Executable, ExternalProgram, compilers.Compiler, mesonlib.File, str)]])], kwargs: 'kwargs.RunCommand', in_builddir: bool=False) -> RunProcess:
    (cmd, cargs) = args
    capture = kwargs['capture']
    env = kwargs['env']
    srcdir = self.environment.get_source_dir()
    builddir = self.environment.get_build_dir()
    check = kwargs['check']
    if (check is None):
        mlog.warning(implicit_check_false_warning, once=True)
        check = False
    overridden_msg = 'Program {!r} was overridden with the compiled executable {!r} and therefore cannot be used during configuration'
    expanded_args: T.List[str] = []
    if isinstance(cmd, build.Executable):
        progname = node.args.arguments[0].value
        raise InterpreterException(overridden_msg.format(progname, cmd.description()))
    if isinstance(cmd, ExternalProgram):
        if (not cmd.found()):
            raise InterpreterException(f'command {cmd.get_name()!r} not found or not executable')
    elif isinstance(cmd, compilers.Compiler):
        exelist = cmd.get_exelist()
        cmd = exelist[0]
        prog = ExternalProgram(cmd, silent=True)
        if (not prog.found()):
            raise InterpreterException(f'Program {cmd!r} not found or not executable')
        cmd = prog
        expanded_args = exelist[1:]
    else:
        if isinstance(cmd, mesonlib.File):
            cmd = cmd.absolute_path(srcdir, builddir)
        search_dir = os.path.join(srcdir, self.subdir)
        prog = ExternalProgram(cmd, silent=True, search_dir=search_dir)
        if (not prog.found()):
            raise InterpreterException(f'Program or command {cmd!r} not found or not executable')
        cmd = prog
    for a in cargs:
        if isinstance(a, str):
            expanded_args.append(a)
        elif isinstance(a, mesonlib.File):
            expanded_args.append(a.absolute_path(srcdir, builddir))
        elif isinstance(a, ExternalProgram):
            expanded_args.append(a.get_path())
        elif isinstance(a, compilers.Compiler):
            FeatureNew.single_use('Compiler object as a variadic argument to `run_command`', '0.61.0', self.subproject, location=node)
            prog = ExternalProgram(a.exelist[0], silent=True)
            if (not prog.found()):
                raise InterpreterException(f'Program {cmd!r} not found or not executable')
            expanded_args.append(prog.get_path())
        else:
            raise InterpreterException(overridden_msg.format(a.name, cmd.description()))
    self.add_build_def_file(cmd.get_path())
    for a in expanded_args:
        if (not os.path.isabs(a)):
            a = os.path.join((builddir if in_builddir else srcdir), self.subdir, a)
        self.add_build_def_file(a)
    return RunProcess(cmd, expanded_args, env, srcdir, builddir, self.subdir, (self.environment.get_build_command() + ['introspect']), in_builddir=in_builddir, check=check, capture=capture)
def run_command_impl(self, node: mparser.BaseNode, args: T.Tuple[(T.Union[(build.Executable, ExternalProgram, compilers.Compiler, mesonlib.File, str)], T.List[T.Union[(build.Executable, ExternalProgram, compilers.Compiler, mesonlib.File, str)]])], kwargs: 'kwargs.RunCommand', in_builddir: bool=False) -> RunProcess:
    (cmd, cargs) = args
    capture = kwargs['capture']
    env = kwargs['env']
    srcdir = self.environment.get_source_dir()
    builddir = self.environment.get_build_dir()
    check = kwargs['check']
    if (check is None):
        mlog.warning(implicit_check_false_warning, once=True)
        check = False
    overridden_msg = 'Program {!r} was overridden with the compiled executable {!r} and therefore cannot be used during configuration'
    expanded_args: T.List[str] = []
    if isinstance(cmd, build.Executable):
        progname = node.args.arguments[0].value
        raise InterpreterException(overridden_msg.format(progname, cmd.description()))
    if isinstance(cmd, ExternalProgram):
        if (not cmd.found()):
            raise InterpreterException(f'command {cmd.get_name()!r} not found or not executable')
    elif isinstance(cmd, compilers.Compiler):
        exelist = cmd.get_exelist()
        cmd = exelist[0]
        prog = ExternalProgram(cmd, silent=True)
        if (not prog.found()):
            raise InterpreterException(f'Program {cmd!r} not found or not executable')
        cmd = prog
        expanded_args = exelist[1:]
    else:
        if isinstance(cmd, mesonlib.File):
            cmd = cmd.absolute_path(srcdir, builddir)
        search_dir = os.path.join(srcdir, self.subdir)
        prog = ExternalProgram(cmd, silent=True, search_dir=search_dir)
        if (not prog.found()):
            raise InterpreterException(f'Program or command {cmd!r} not found or not executable')
        cmd = prog
    for a in cargs:
        if isinstance(a, str):
            expanded_args.append(a)
        elif isinstance(a, mesonlib.File):
            expanded_args.append(a.absolute_path(srcdir, builddir))
        elif isinstance(a, ExternalProgram):
            expanded_args.append(a.get_path())
        elif isinstance(a, compilers.Compiler):
            FeatureNew.single_use('Compiler object as a variadic argument to `run_command`', '0.61.0', self.subproject, location=node)
            prog = ExternalProgram(a.exelist[0], silent=True)
            if (not prog.found()):
                raise InterpreterException(f'Program {cmd!r} not found or not executable')
            expanded_args.append(prog.get_path())
        else:
            raise InterpreterException(overridden_msg.format(a.name, cmd.description()))
    self.add_build_def_file(cmd.get_path())
    for a in expanded_args:
        if (not os.path.isabs(a)):
            a = os.path.join((builddir if in_builddir else srcdir), self.subdir, a)
        self.add_build_def_file(a)
    return RunProcess(cmd, expanded_args, env, srcdir, builddir, self.subdir, (self.environment.get_build_command() + ['introspect']), in_builddir=in_builddir, check=check, capture=capture)