Internal function to isolate an exec. Executes ``data`` and returns the
  ``expr`` evaluation afterwards.
770526
def _exec_eval(data, expr):
  
  ns = {}
  exec(data, ns)
  return eval(expr, ns)
475327
def handle_connection_exec(client):
    
    class ExitExecLoop(Exception):
        pass

    def exit():
        raise ExitExecLoop()

    client.settimeout(None)
    fh = os.fdopen(client.detach() if hasattr(client, 'detach') else client.fileno())

    with closing(client):
        with closing(fh):
            try:
                payload = fh.readline()
                while payload:
                    _LOG("Running: %r." % payload)
                    eval(compile(payload, '<manhole>', 'exec'), {'exit': exit}, _MANHOLE.locals)
                    payload = fh.readline()
            except ExitExecLoop:
                _LOG("Exiting exec loop.")
1138476
function exec(cmd) {
    const ret = shell.exec(cmd, {
        silent: true
    });

    if (ret.code != 0) {
        console.error("Error:", ret.stdout, ret.stderr);
        process.exit(1);
    }
    return ret;
}
701532
def shell_exec(command):
    """"""
    out = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0]
    return out.decode('utf-8')
1021318
def execute(self, command):
        """"""
        process = subprocess.Popen(
            command,
            preexec_fn=lambda: signal.signal(signal.SIGPIPE, signal.SIG_DFL)
        )
        return process
600364
def do_execute(self):
        
        expr = str(self.resolve_option("expression"))
        expr = expr.replace("{X}", str(self.input.payload))
        self._output.append(Token(eval(expr)))
        return None
466624
def _exec(self, detach=True):
        
        kwargs = {
            'pidfile': self.pidfile,
            'working_directory': self.home_dir,
            }

        # FIXME - doesn't work
        if not detach:
            kwargs.update({
                'detach_process': False,
                'files_preserve': [0,1,2],
                'stdout': sys.stdout,
                'stderr': sys.stderr,
                })

        ctx = daemon.DaemonContext(**kwargs)

        with ctx:
            self._main()
740892
def execute(cmd):
  '''  '''
  try:
    return safely_decode(check_output(cmd))
  except Exception as e:
    logger.warn(u'Couldnt execute cmd: %s.\nReason: %s' % (cmd, e))
    return None
1082505
def exec_func(code, glob_vars, loc_vars=None):
    """"""
    if loc_vars is None:
        exec(code, glob_vars)
    else:
        exec(code, glob_vars, loc_vars)
1195896
async def execute_process(*cmd, log=None, loop=None):
    '''
    

    '''
    p = await asyncio.create_subprocess_exec(
        *cmd,
        stdin=asyncio.subprocess.PIPE,
        stdout=asyncio.subprocess.PIPE,
        stderr=asyncio.subprocess.PIPE,
        loop=loop)
    stdout, stderr = await p.communicate()
    if log:
        log.debug("Exec %s -> %d", cmd, p.returncode)
        if stdout:
            log.debug(stdout.decode('utf-8'))
        if stderr:
            log.debug(stderr.decode('utf-8'))
    return p.returncode == 0
1182483
def exec_result(obj, local, stream):
    """"""
    local['_'] = obj
    if obj is not None:
        print(repr(obj), file=stream)
1110780
function exec (cmd, callback) {
  debug('executing cmd', cmd)
  child_process.exec(cmd, function (err, stdout, stderr) {
    debug('command completed')
    if (err) {
      if (callback) {
        callback(err)
      }
    } else {
      if (callback) {
        callback(null, stdout, stderr)
      }
    }
  })
}
1158704
def evaluate(self, data):
        """"""
        return 'PYTHONPATH="{runtime}" python3 -u -m resolwe.process {program} --slug {slug} --inputs {inputs}'.format(
            runtime=PYTHON_RUNTIME_VOLUME,
            program=PYTHON_PROGRAM_VOLUME,
            slug=shlex.quote(data.process.slug),
            inputs=PYTHON_INPUTS_VOLUME,
        )
179699
def execProcCmd(self, *args):
        
        out = util.exec_command([psCmd,] + list(args))
        return out.splitlines()
469434
def _process_execs(self, execmatch, parent, module):
        """"""
        #Get the matches that must be present for every executable.
        name = execmatch.group("name").strip()
        modifiers = execmatch.group("modifiers")
        if modifiers is None:
            modifiers = []
        else:
            modifiers = re.split(",[ \t]*", modifiers)
        codetype = execmatch.group("codetype")
        params = re.split("[\s,]+", execmatch.group("parameters"))
        contents = execmatch.group("contents")

        #If the exec is a function, we also may have a type and kind specified.
        if codetype.lower() == "function":
            dtype = execmatch.group("type")
            kind = execmatch.group("kind")
            result = Function(name, modifiers, dtype, kind, parent)
        else:
            result = Subroutine(name, modifiers, parent)

        #Set the regex start and end char indices
        result.start, result.end = module.absolute_charindex(execmatch.string, execmatch.start(),
                                                             execmatch.end())
        result.contents = contents

        #Now we can handle the rest which is common to both types of executable
        #Extract a list of local variables
        self._parse_members(contents, result, params)
        if isinstance(result, Function):
            #We need to handle the syntax for defining a function with result(variable)
            #to specify the return type of the function.
            if execmatch.group("result") is not None:
                resvar = execmatch.group("result").lower().split("result(")[1].replace(")", "")
            else:
                resvar = None
            result.update_dtype(resvar)
        
        #Fortran allows lines to be continued using &. The easiest way
        #to deal with this is to remove all of those before processing
        #any of the regular expressions
        decommented = "\n".join([ self._depend_exec_clean(l) for l in contents.split("\n") ])
        cleaned = re.sub("&\s*", "", decommented)

        #Finally, process the dependencies. These are calls to functions and
        #subroutines from within the executable body
        self._process_dependencies(result, cleaned)
        self._process_assignments(result, cleaned)
        
        return result
1351235
function evalExpr(expr, data, owner) {
    if (expr.value != null) {
        return expr.value;
    }

    var value;

    switch (expr.type) {
        case ExprType.UNARY:
            value = evalExpr(expr.expr, data, owner);
            switch (expr.operator) {
                case 33:
                    value = !value;
                    break;

                case 45:
                    value = 0 - value;
                    break;
            }
            return value;

        case ExprType.BINARY:
            value = evalExpr(expr.segs[0], data, owner);
            var rightValue = evalExpr(expr.segs[1], data, owner);

            /* eslint-disable eqeqeq */
            switch (expr.operator) {
                case 37:
                    value = value % rightValue;
                    break;

                case 43:
                    value = value + rightValue;
                    break;

                case 45:
                    value = value - rightValue;
                    break;

                case 42:
                    value = value * rightValue;
                    break;

                case 47:
                    value = value / rightValue;
                    break;

                case 60:
                    value = value < rightValue;
                    break;

                case 62:
                    value = value > rightValue;
                    break;

                case 76:
                    value = value && rightValue;
                    break;

                case 94:
                    value = value != rightValue;
                    break;

                case 121:
                    value = value <= rightValue;
                    break;

                case 122:
                    value = value == rightValue;
                    break;

                case 123:
                    value = value >= rightValue;
                    break;

                case 155:
                    value = value !== rightValue;
                    break;

                case 183:
                    value = value === rightValue;
                    break;

                case 248:
                    value = value || rightValue;
                    break;

            }
            /* eslint-enable eqeqeq */
            return value;

        case ExprType.TERTIARY:
            return evalExpr(
                expr.segs[evalExpr(expr.segs[0], data, owner) ? 1 : 2],
                data,
                owner
            );


        case ExprType.ARRAY:
            value = [];
            for (var i = 0, l = expr.items.length; i < l; i++) {
                var item = expr.items[i];
                var itemValue = evalExpr(item.expr, data, owner);

                if (item.spread) {
                    itemValue && (value = value.concat(itemValue));
                }
                else {
                    value.push(itemValue);
                }
            }
            return value;

        case ExprType.OBJECT:
            value = {};
            for (var i = 0, l = expr.items.length; i < l; i++) {
                var item = expr.items[i];
                var itemValue = evalExpr(item.expr, data, owner);

                if (item.spread) {
                    itemValue && extend(value, itemValue);
                }
                else {
                    value[evalExpr(item.name, data, owner)] = itemValue;
                }
            }
            return value;

        case ExprType.ACCESSOR:
            return data.get(expr);


        case ExprType.INTERP:
            value = evalExpr(expr.expr, data, owner);

            if (owner) {
                for (var i = 0, l = expr.filters.length; i < l; i++) {
                    var filter = expr.filters[i];
                    var filterName = filter.name.paths[0].value;

                    if (owner.filters[filterName]) {
                        value = owner.filters[filterName].apply(
                            owner,
                            [value].concat(evalArgs(filter.args, data, owner))
                        );
                    }
                    else if (DEFAULT_FILTERS[filterName]) {
                        value = DEFAULT_FILTERS[filterName](value);
                    }
                }
            }

            if (value == null) {
                value = '';
            }

            return value;

        case ExprType.CALL:
            if (owner && expr.name.type === ExprType.ACCESSOR) {
                var method = owner;
                var pathsLen = expr.name.paths.length;

                for (var i = 0; method && i < pathsLen; i++) {
                    method = method[evalExpr(expr.name.paths[i], data, owner)];
                }

                if (method) {
                    value = method.apply(owner, evalArgs(expr.args, data, owner));
                }
            }

            break;

        /* eslint-disable no-redeclare */
        case ExprType.TEXT:
            var buf = '';
            for (var i = 0, l = expr.segs.length; i < l; i++) {
                var seg = expr.segs[i];
                buf += seg.value || evalExpr(seg, data, owner);
            }
            return buf;
    }

    return value;
}
1140647
def _exec(cmd):
        
        process = subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)

        # pylint: disable=unexpected-keyword-arg
        (stdout, stderr) = process.communicate(timeout=defaults.DEFAULT_VCS_TIMEOUT)

        return process.returncode, stdout.decode(), stderr.decode()