Install signal handler.

@return void
354375
protected static function installSignal()
    {
        // stop
        swoole_process::signal(SIGINT, array('\Workerman\Worker', 'signalHandler'));
        // reload
        swoole_process::signal(SIGUSR1, array('\Workerman\Worker', 'signalHandler'));
        // status
        swoole_process::signal(SIGUSR2, array('\Workerman\Worker', 'signalHandler'));
    }
1142622
public function handler($signal) {
        switch ($signal) {
            case SIGALRM :
                $this->isStopped = true;
                $this->closeChildren();
                break;
            case SIGINT :
            case SIGKILL :
                $this->broadcast($signal);
                exit;
            default: break;
        }
    }
483562
function install(cleanupHandler, stderrMessages)
{
    if (cleanupHandler) {
        if (typeof cleanupHandler === 'object') {
            stderrMessages = cleanupHandler;
            cleanupHandler = null;
        }
    }
    else if (!stderrMessages)
        stderrMessages = DEFAULT_MESSAGES;
    
    if (stderrMessages) {
        if (messages === null)
            messages = { ctrl_C: '', uncaughtException: '' };
        if (typeof stderrMessages.ctrl_C === 'string')
            messages.ctrl_C = stderrMessages.ctrl_C;
        if (typeof stderrMessages.uncaughtException === 'string')
            messages.uncaughtException = stderrMessages.uncaughtException;
    }
    
    if (cleanupHandlers === null) {
        cleanupHandlers = []; // establish before installing handlers
        
        sigintHandler = signalHandler.bind(this, 'SIGINT');
        sighupHandler = signalHandler.bind(this, 'SIGHUP');
        sigquitHandler = signalHandler.bind(this, 'SIGQUIT');
        sigtermHandler = signalHandler.bind(this, 'SIGTERM');
        
        process.on('SIGINT', sigintHandler);
        process.on('SIGHUP', sighupHandler);
        process.on('SIGQUIT', sigquitHandler);
        process.on('SIGTERM', sigtermHandler);
        process.on('uncaughtException', exceptionHandler);
        process.on('exit', exitHandler);

        cleanupHandlers.push(cleanupHandler || noCleanup);
    }
    else if (cleanupHandler)
        cleanupHandlers.push(cleanupHandler);
}
530700
public function callHandler($handler_id, array $data)
    {
        try {
            $handlers = $this->getHandlers();
            $method = isset($data['step']) ? 'install_' . $data['step'] : 'install';
            $result = Handler::call($handlers, $handler_id, $method, array($data, $this->db));
        } catch (Exception $ex) {
            $result = array();
        }

        return (array) $result;
    }
636462
protected function registerInstallCommand(): void
    {
        $this->app->singleton('orchestra.commands.tenanti.install', function (Application $app) {
            return new InstallCommand($app->make('orchestra.tenanti'));
        });
    }
286601
protected function configure() : void
    {
        $this->setName('install')
             ->setDescription('Install git hooks')
             ->setHelp('This command will install the git hooks to your .git directory')
             ->addArgument('hook', InputArgument::OPTIONAL, 'Hook you want to install')
             ->addOption(
                 'configuration',
                 'c',
                 InputOption::VALUE_OPTIONAL,
                 'Path to your json configuration',
                 getcwd() . DIRECTORY_SEPARATOR . CH::CONFIG
             )->addOption('force', 'f', InputOption::VALUE_NONE, 'Force to overwrite existing hooks')
             ->addOption(
                 'git-directory',
                 'g',
                 InputOption::VALUE_OPTIONAL,
                 'Path to your .git directory',
                 getcwd() . DIRECTORY_SEPARATOR . '.git'
             );
    }
1202044
public function install()
    {
        if (0 === $this->isolator->error_reporting()) {
            throw new ErrorHandlingConfigurationException();
        }

        if ($this->isInstalled()) {
            throw new AlreadyInstalledException();
        }

        $this->stack->push($this);
    }
524733
def install_handler(self, app):
        """"""
        # Configure python logging
        if app.config['LOGGING_CONSOLE_PYWARNINGS']:
            self.capture_pywarnings(logging.StreamHandler())

        if app.config['LOGGING_CONSOLE_LEVEL'] is not None:
            for h in app.logger.handlers:
                h.setLevel(app.config['LOGGING_CONSOLE_LEVEL'])

        # Add request_id to log record
        app.logger.addFilter(add_request_id_filter)
1191082
def install_handler(self, app):
        """"""
        from raven.contrib.celery import register_logger_signal, \
            register_signal
        from raven.contrib.flask import Sentry, make_client
        from raven.handlers.logging import SentryHandler

        # Installs sentry in app.extensions['sentry']
        level = getattr(logging, app.config['LOGGING_SENTRY_LEVEL'])

        # Get the Sentry class.
        cls = app.config['LOGGING_SENTRY_CLASS']
        if cls:
            if isinstance(cls, six.string_types):
                cls = import_string(cls)
        else:
            cls = Sentry

        sentry = cls(
            app,
            logging=True,
            level=level
        )

        app.logger.addHandler(SentryHandler(client=sentry.client, level=level))

        # Capture warnings from warnings module
        if app.config['LOGGING_SENTRY_PYWARNINGS']:
            self.capture_pywarnings(
                SentryHandler(sentry.client))

        # Setup Celery logging to Sentry
        if app.config['LOGGING_SENTRY_CELERY']:
            try:
                register_logger_signal(sentry.client, loglevel=level)
            except TypeError:
                # Compatibility mode for Raven<=5.1.0
                register_logger_signal(sentry.client)
            register_signal(sentry.client)

        # Werkzeug only adds a stream handler if there's no other handlers
        # defined, so when Sentry adds a log handler no output is
        # received from Werkzeug unless we install a console handler
        # here on the werkzeug logger.
        if app.debug:
            logger = logging.getLogger('werkzeug')
            logger.setLevel(logging.INFO)
            logger.addHandler(logging.StreamHandler())
748499
def setup_sighandlers(self):
        """"""
        signal.signal(signal.SIGINT, signal.SIG_IGN)
        signal.signal(signal.SIGTERM, signal.SIG_IGN)

        signal.signal(signal.SIGPROF, self.on_sigprof)
        signal.signal(signal.SIGABRT, self.stop)

        signal.siginterrupt(signal.SIGPROF, False)
        signal.siginterrupt(signal.SIGABRT, False)
        LOGGER.debug('Signal handlers setup')
1342818
def _signal_handler_init(self):
        """"""
        signal.signal(signal.SIGINT, signal.SIG_IGN)
        signal.signal(signal.SIGINT, self._signal_handler)
        signal.signal(signal.SIGTERM, self._signal_handler)
893327
function install()
    {
        if (!$this->brew->hasInstalledNginx()) {
            $this->brew->installOrFail('nginx', []);
        }

        $this->installConfiguration();
        $this->installServer();
        $this->installNginxDirectory();
    }
429676
public function boot()
    {
        // Lumen is limited, so always add the preflight.
        if ($this->isLumen()) {
            $this->app->middleware([HandlePreflight::class]);
        } else {
            $this->publishes([$this->configPath() => config_path('cors.php')]);

            /** @var \Illuminate\Foundation\Http\Kernel $kernel */
            $kernel = $this->app->make(Kernel::class);

            // When the HandleCors middleware is not attached globally, add the PreflightCheck
            if (! $kernel->hasMiddleware(HandleCors::class)) {
                $kernel->prependMiddleware(HandlePreflight::class);
            }
        }
    }
67214
function install()
    {
        if (! $this->brew->hasInstalledPhp()) {
            $this->brew->ensureInstalled('php', [], $this->taps);
        }

        $this->files->ensureDirExists('/usr/local/var/log', user());

        $this->updateConfiguration();

        $this->restart();
    }
1232684
public function register(string $signal, callable $handler): self
    {
        $this->handlers[$signal][] = $handler;

        return $this;
    }
171744
def signal_handler(self, *args):
        
        self.user_callback(self.signal, self.user_arg, *args)
696013
public function install()
    {
        $connections = ConnectionManager::configured();
        if (empty($connections)) {
            $this->out('Your database configuration was not found.');
            $this->out('Add your database connection information to config/app.php.');
            return false;
        }

        $this->migrate();
        $this->migrate('Users');
        $this->migrate('Permissions');

        $this->cleanup();
    }