def run_command_impl(self, node, args, kwargs, in_builddir=False):
    if (len(args) < 1):
        raise InterpreterException('Not enough arguments')
    (cmd, *cargs) = args
    capture = kwargs.get('capture', True)
    srcdir = self.environment.get_source_dir()
    builddir = self.environment.get_build_dir()
    check = kwargs.get('check', False)
    if (not isinstance(check, bool)):
        raise InterpreterException('Check must be boolean.')
    env = self.unpack_env_kwarg(kwargs)
    m = 'must be a string, or the output of find_program(), files() or configure_file(), or a compiler object; not {!r}'
    expanded_args = []
    if isinstance(cmd, ExternalProgramHolder):
        cmd = cmd.held_object
        if isinstance(cmd, build.Executable):
            progname = node.args.arguments[0].value
            msg = 'Program {!r} was overridden with the compiled executable {!r} and therefore cannot be used during configuration'
            raise InterpreterException(msg.format(progname, cmd.description()))
        if (not cmd.found()):
            raise InterpreterException('command {!r} not found or not executable'.format(cmd.get_name()))
    elif isinstance(cmd, CompilerHolder):
        exelist = cmd.compiler.get_exelist()
        cmd = exelist[0]
        prog = ExternalProgram(cmd, silent=True)
        if (not prog.found()):
            raise InterpreterException('Program {!r} not found or not executable'.format(cmd))
        cmd = prog
        expanded_args = exelist[1:]
    else:
        if isinstance(cmd, mesonlib.File):
            cmd = cmd.absolute_path(srcdir, builddir)
        elif (not isinstance(cmd, str)):
            raise InterpreterException(('First argument ' + m.format(cmd)))
        search_dir = os.path.join(srcdir, self.subdir)
        prog = ExternalProgram(cmd, silent=True, search_dir=search_dir)
        if (not prog.found()):
            raise InterpreterException('Program or command {!r} not found or not executable'.format(cmd))
        cmd = prog
    for a in listify(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, ExternalProgramHolder):
            expanded_args.append(a.held_object.get_path())
        else:
            raise InterpreterException(('Arguments ' + m.format(a)))
    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, args, kwargs, in_builddir=False):
    if (len(args) < 1):
        raise InterpreterException('Not enough arguments')
    (cmd, *cargs) = args
    capture = kwargs.get('capture', True)
    srcdir = self.environment.get_source_dir()
    builddir = self.environment.get_build_dir()
    check = kwargs.get('check', False)
    if (not isinstance(check, bool)):
        raise InterpreterException('Check must be boolean.')
    env = self.unpack_env_kwarg(kwargs)
    m = 'must be a string, or the output of find_program(), files() or configure_file(), or a compiler object; not {!r}'
    expanded_args = []
    if isinstance(cmd, ExternalProgramHolder):
        cmd = cmd.held_object
        if isinstance(cmd, build.Executable):
            progname = node.args.arguments[0].value
            msg = 'Program {!r} was overridden with the compiled executable {!r} and therefore cannot be used during configuration'
            raise InterpreterException(msg.format(progname, cmd.description()))
        if (not cmd.found()):
            raise InterpreterException('command {!r} not found or not executable'.format(cmd.get_name()))
    elif isinstance(cmd, CompilerHolder):
        exelist = cmd.compiler.get_exelist()
        cmd = exelist[0]
        prog = ExternalProgram(cmd, silent=True)
        if (not prog.found()):
            raise InterpreterException('Program {!r} not found or not executable'.format(cmd))
        cmd = prog
        expanded_args = exelist[1:]
    else:
        if isinstance(cmd, mesonlib.File):
            cmd = cmd.absolute_path(srcdir, builddir)
        elif (not isinstance(cmd, str)):
            raise InterpreterException(('First argument ' + m.format(cmd)))
        search_dir = os.path.join(srcdir, self.subdir)
        prog = ExternalProgram(cmd, silent=True, search_dir=search_dir)
        if (not prog.found()):
            raise InterpreterException('Program or command {!r} not found or not executable'.format(cmd))
        cmd = prog
    for a in listify(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, ExternalProgramHolder):
            expanded_args.append(a.held_object.get_path())
        else:
            raise InterpreterException(('Arguments ' + m.format(a)))
    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)