承接 fichtme/symfony-command-runner 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fichtme/symfony-command-runner

最新稳定版本:4.0.1

Composer 安装命令:

composer require fichtme/symfony-command-runner

包简介

Run multiple commands async

README 文档

README

Run multiple commands in another process and wait for completion.

Usage

(new CommandRunner([
            new Process("my:command -q"),
            new Process("my:command2 -q"),
            new Process("my:command3 -q").
            new Process("my:command4 -q"),
            new Process("my:command5 -q"),
            new Process("my:command6 -q --env=$env"),
        ]))
            ->continueOnError(true)
            ->setIO($this->io)
            ->setLimit(3)
            ->run();
            

Possible use case:

/**
 * Class UpdateCommand
 *
 * @package App\Command\Update
 */
class UpdateCommand extends AbstractCommand
{
    /**
     * Configures the current command.
     */
    protected function configure()
    {
        $this->setName('app:update')
            ->setDescription('execute updates');
    }

    /**
     * @param InputInterface  $input
     * @param OutputInterface $output
     *
     * @return int
     */
    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $this->io->writeln('Running update scripts');

        sleep(5); # Sleep so user can abort update
        
        (new CommandRunner([
            new Process("my:command -q"),
            new Process("my:command2 -q"),
            new Process("my:command3 -q").
            new Process("my:command4 -q"),
            new Process("my:command5 -q"),
            new Process("my:command6 -q"),
        ]))
            ->continueOnError(true)
            ->setIO($this->io)
            ->setLimit(3)
            ->run();
            
        return 0;
    }
}

统计信息

  • 总下载量: 9.76k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-23