alexeyshockov/symfony-signal-helper
Composer 安装命令:
composer require alexeyshockov/symfony-signal-helper
包简介
Symfony Console helper to handle process signals (like termination)
README 文档
README
Helper for Symfony Console to handle process signals (like termination).
Installation
$ composer require alexeyshockov/symfony-signal-helper
Usage
Just register the helper in your application (app/console, for example):
#!/usr/bin/env php <?php // ... $console = new Application(); $console->getHelperSet()->set(new SignalHelper()); $console->run($input);
And use it inside your command:
protected function execute(InputInterface $input, OutputInterface $output) { $helper = $this->getHelper('signal'); $helper->listen(); while (true) { if (count(array_intersect([SIGINT, SIGTERM], $helper->takeSignals())) > 0) { // Stop by any of SIGINT or SIGTERM. break; } // Some business logic. } }
统计信息
- 总下载量: 55.32k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-11-11