process handlers
429581
function cmdProcess(file, flow, command, startFn, doneFn){
  var packStartTime = new Date;
  var fconsole = flow.console;
  var gcc;

  fconsole.log('Init compression for ' + file.relOutputFilename);
  gcc = exec(
    command, {
      maxBuffer: 10 * 1024 * 1024
    }, function(error, stdout, stderr){
      stderr = String(stderr || '').replace(/^The compiler is waiting for input via stdin\.\r?\n/, '');

      if (stderr)
      {
        var errorMsg;

        if (stderr.match(/^stdin:(\d+):\s+(.+)/))
        {
          var CHARS = 40;
          var lines = stderr.split(/\r\n?|\n\r?/);
          var m = (lines[2] || '').match(/^\s*/);
          var pos = (m ? m[0].length : 0);
          var left = Math.min(pos, CHARS);

          errorMsg =
            lines[0] + '\n' +
            (pos > CHARS ? '...' : '') +
            lines[1].substr(pos - left, CHARS) +
            lines[1].substr(pos, CHARS) +
            (pos + CHARS < stderr.length ? '...' : '') + '\n' +
            repeat(' ', left + (pos > CHARS ? 3 : 0)) + '^';
        }
        else
          errorMsg = stderr.length < 256
            ? stderr
            : stderr.substr(0, 128) + '...' + stderr.substr(stderr.length - 128);

        flow.warn({
          fatal: true,
          message:
            file.relOutputFilename + ' compression error:\n' +
            errorMsg
        });

        return doneFn();
      }

      fconsole.log(file.relOutputFilename + ' compressed in ' + ((new Date - packStartTime) / 1000).toFixed(3) + 's');
      if (error !== null)
        fconsole.log('exec error: ' + error);
      else
        file.outputContent = stdout.replace(/;[\r\n\s]*$/, '');

      doneFn();
    }
  );

  startFn();
  gcc.stdin.on('error', function(error){
    flow.warn({
      fatal: true,
      message:
        'Pack command: `' + command + '`\n' +
        error
    });
  });
  gcc.stdin.write(file.outputContent);
  gcc.stdin.end();
}
1066938
function handleStdoutWrite() {
    let stream = process.stderr;
    let str = arguments[0];
    if (typeof str === 'string') {
        if (str.includes('\n')) {
            let result = parseDisplayLength(str, 0, stream.columns);
            readline.clearLine(stream, 1);
            for (let i = 0; i < result.yLength; i++) {
                stream.write('\n');
                readline.clearLine(stream, 0);
            }
            readline.moveCursor(stream, 0, -result.yLength);
        }
        else {
            readline.clearLine(stream, 1);
        }
    }
    stdoutWrite.apply(process.stdout, arguments);
    if (typeof str === 'string')
        readline.clearLine(stream, 1);
}
278537
def make_handlers(base_url, server_processes):
    
    handlers = []
    for sp in server_processes:
        handler = _make_serverproxy_handler(
            sp.name,
            sp.command,
            sp.environment,
            sp.timeout,
            sp.absolute_url,
            sp.port,
        )
        handlers.append((
            ujoin(base_url, sp.name, r'(.*)'), handler, dict(state={}),
        ))
        handlers.append((
            ujoin(base_url, sp.name), AddSlashHandler
        ))
    return handlers
385360
def help(handler):
    
    data = {'operation': 'describe'}
    response = handler.invoke(data, raw=True)
    description = response.data
    lines = []
    lines.append('# {}'.format(handler.lambda_fn))
    lines.append('## Handler Info')
    lines.append('**Cruddy version**: {}'.format(
        description['cruddy_version']))
    lines.append('')
    lines.append('**Table name**: {}'.format(description['table_name']))
    lines.append('')
    lines.append('**Supported operations**:')
    lines.append('')
    for op in description['supported_operations']:
        lines.append('* {}'.format(op))
    lines.append('')
    lines.append('**Prototype**:')
    lines.append('')
    lines.append('```')
    lines.append(str(description['prototype']))
    lines.append('```')
    lines.append('')
    lines.append('## Operations')
    for op_name in description['operations']:
        op = description['operations'][op_name]
        lines.append('### {}'.format(op_name))
        lines.append('')
        lines.append(_build_signature_line(
            op_name, description['operations'][op_name]['argspec']))
        lines.append('')
        if op['docs'] is None:
            lines.append('')
        else:
            lines.append(op['docs'])
        lines.append('')
    click.echo('\n'.join(lines))
678024
function handleEvent(cmd, context, filename, callback) {
  var event = JSON.parse(cmd)
  eventline.route(event)
}
171744
def signal_handler(self, *args):
        
        self.user_callback(self.signal, self.user_arg, *args)
578497
async def handler(event):
    """"""
    await asyncio.wait([
        event.delete(),
        event.respond(
            LEARN_PYTHON, reply_to=event.reply_to_msg_id, link_preview=False)
    ])
84173
void executeHandlers(EventBatch<AuditEvent> batch) {
        String formattedEvent = "";
        for (AuditEvent auditEvent : batch) {
            formattedEvent = formattedEvent + configContext.getLayout().format(auditEvent) + '\n';
        }
        for (final Handler handler : configContext.getHandlers()) {
            handler.setEventBatch(batch);
            handler.setQuery(formattedEvent);
            try {
                //handler.handle();
                handler.handle(batch);
                handler.handle(formattedEvent);
            } catch (HandlerException e) {
                Log.warn("Failed to submit audit event.", e);
            }
        }
    }
310609
private function executeHandlers()
	{
        $this->state = self::STATE_HANDLING;
    	    
    	$this->handleRouter();
    	$this->handleSessions();
    	$this->handleLogout();
    	$this->handleDictionary($_COOKIE, $this->getSetting('fallbacklocale')); //Handle Dictionary
    }
72786
public void handle() {
        try {
            for (handleIndex++; handleIndex < handlers.size(); handleIndex++) {
                handlers.get(handleIndex).handle(this);
            }
        } catch (final Exception e) {
            final String requestLog = Requests.getLog(request);
            LOGGER.log(Level.ERROR, "Handler process failed: " + requestLog, e);

            setRenderer(new Http500Renderer(e));
        }
    }
533812
def close_process_handles(self):
        
        for pid in self.get_process_ids():
            aProcess = self.get_process(pid)
            try:
                aProcess.close_handle()
            except Exception:
                e = sys.exc_info()[1]
                try:
                    msg = "Cannot close process handle %s, reason: %s"
                    msg %= (aProcess.hProcess.value, str(e))
                    warnings.warn(msg)
                except Exception:
                    pass
1337972
def _RegisterFlowProcessingHandler(self, handler):
    """"""
    self.flow_handler_stop = False
    self.flow_handler_thread = threading.Thread(
        name="flow_processing_handler",
        target=self._HandleFlowProcessingRequestLoop,
        args=(handler,))
    self.flow_handler_thread.daemon = True
    self.flow_handler_thread.start()
704018
function(curr, name, value) {
        /* global process: true */
        /* global setImmediate: true */
        /* global setTimeout: true */

        /*  short-circuit processing  */
        if (curr[name].length === 0)
            return;

        /*  iterate over all handlers, exactly once  */
        var handlers = curr[name];
        curr[name] = [];                                             /*  [Promises/A+ 2.2.2.3, 2.2.3.3]  */
        var func = function() {
            for (var i = 0; i < handlers.length; i++)
                handlers[i](value);                                  /*  [Promises/A+ 2.2.5]  */
        };

        /*  execute procedure asynchronously  */                     /*  [Promises/A+ 2.2.4, 3.1]  */
        if (typeof process === 'object' && typeof process.nextTick === 'function')
            process.nextTick(func);
        else if (typeof setImmediate === 'function')
            setImmediate(func);
        else
            setTimeout(func, 0);
    }
39176
private void processResultHandlers(RHI resultHandlerInput) {
        for (ResultHandler<RHI> resultHandler : resultHandlers) {
            resultHandler.handleResult(resultHandlerInput);
        }
    }
834960
def handler(self, event):
        """"""

        if self.escape(event):  # A chance to escape
            self.stop()
        elif self.diagnostic:
            self._diagnostic(event)
        else:
            self._tap(event)
        #This is needed according to the pyHook tutorials 'http://sourceforge.net/apps/mediawiki/pyhook/index.php?title=PyHook_Tutorial'
        return True
859458
def detect_process(cls, headers):
    """"""

    try:
      if 'Libprocess-From' in headers:
        return PID.from_string(headers['Libprocess-From']), False
      elif 'User-Agent' in headers and headers['User-Agent'].startswith('libprocess/'):
        return PID.from_string(headers['User-Agent'][len('libprocess/'):]), True
    except ValueError as e:
      log.error('Failed to detect process: %r' % e)
      pass

    return None, None
293665
function(process, callback) {
    if (callback !== undefined && typeof callback === 'function') {
      CALLBACK = callback
    }
    if (cluster.isMaster) {
      process.on('message', masterHandler)
    }
    else {
      process.on('message', workerHandler)
    }
  }