当前位置: 首页>>代码示例>>PHP>>正文


PHP PhpProcess::wait方法代码示例

本文整理汇总了PHP中Symfony\Component\Process\PhpProcess::wait方法的典型用法代码示例。如果您正苦于以下问题:PHP PhpProcess::wait方法的具体用法?PHP PhpProcess::wait怎么用?PHP PhpProcess::wait使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Process\PhpProcess的用法示例。


在下文中一共展示了PhpProcess::wait方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testNonBlockingWorks

    public function testNonBlockingWorks()
    {
        $expected = 'hello world!';
        $process = new PhpProcess(<<<PHP
<?php echo '{$expected}';
PHP
);
        $process->start();
        $process->wait();
        $this->assertEquals($expected, $process->getOutput());
    }
开发者ID:mawaha,项目名称:tracker,代码行数:11,代码来源:PhpProcessTest.php

示例2: testCommandLine

    public function testCommandLine()
    {
        $process = new PhpProcess(<<<'PHP'
<?php echo 'foobar';
PHP
);
        $commandLine = $process->getCommandLine();
        $f = new PhpExecutableFinder();
        $this->assertContains($f->find(), $commandLine, '::getCommandLine() returns the command line of PHP before start');
        $process->start();
        $this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after start');
        $process->wait();
        $this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait');
    }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:14,代码来源:PhpProcessTest.php

示例3: testCommandLine

    public function testCommandLine()
    {
        if ('phpdbg' === PHP_SAPI) {
            $this->markTestSkipped('phpdbg SAPI is not supported by this test.');
        }
        $process = new PhpProcess(<<<PHP
<?php echo 'foobar';
PHP
);
        $f = new PhpExecutableFinder();
        $commandLine = $f->find();
        $this->assertSame($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP before start');
        $process->start();
        $this->assertSame($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after start');
        $process->wait();
        $this->assertSame($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait');
    }
开发者ID:nix9,项目名称:laracasts,代码行数:17,代码来源:PhpProcessTest.php

示例4: testCompressEventsKate

 /**
  * @medium
  * @dataProvider backends
  */
 public function testCompressEventsKate($backend)
 {
     // CREATE web.scssdx1493.new
     // MODIFY web.scssdx1493.new
     // MOVED_FROM web.scssdx1493.new
     // MOVED_TO web.scss
     if (!$backend->isAvailable()) {
         $this->markTestSkipped();
     }
     $f = __DIR__ . '/test/';
     sleep(1);
     $php = "<?php sleep(2);\n        file_put_contents('{$f}foo.txtdx1493.new', 'x');\n        rename('{$f}foo.txtdx1493.new', '{$f}foo.txt');\n\n        file_put_contents('{$f}stop.txt', 'x');\n        ";
     $process = new PhpProcess($php);
     $process->start();
     $gotEvents = array();
     $backend->setPath(__DIR__ . '/test');
     $backend->addListener(ModifyEvent::NAME, function ($e) use(&$gotEvents, $backend) {
         $gotEvents[] = 'modify';
     });
     $backend->addListener(CreateEvent::NAME, function ($e) use(&$gotEvents, $backend) {
         if ($e->filename == __DIR__ . '/test/stop.txt') {
             $backend->stop();
         } else {
             $gotEvents[] = 'create';
         }
     });
     $backend->addListener(DeleteEvent::NAME, function ($e) use(&$gotEvents, $backend) {
         $gotEvents[] = 'delete';
     });
     $backend->addListener(MoveEvent::NAME, function ($e) use(&$gotEvents, $backend) {
         $gotEvents[] = 'move';
     });
     $backend->start();
     $process->wait();
     $this->assertTrue($process->isSuccessful());
     $this->assertEquals($gotEvents, array('modify'));
 }
开发者ID:koala-framework,项目名称:file-watcher,代码行数:41,代码来源:BasicTest.php

示例5: wait

 /**
  * Waits for the process to terminate.
  *
  * The callback receives the type of output (out or err) and some bytes
  * from the output in real-time while writing the standard input to the process.
  * It allows to have feedback from the independent process during execution.
  *
  * @param callable|null $callback A valid PHP callback
  *
  * @throws RuntimeException When process timed out
  * @throws RuntimeException When process stopped after receiving signal
  * @throws LogicException   When process is not yet started
  *
  * @return int The returnValue of the Closure
  */
 public function wait($callback = null)
 {
     parent::wait($callback);
     return $this->getReturnValue();
 }
开发者ID:liuggio,项目名称:spawn,代码行数:20,代码来源:ClosureProcess.php


注:本文中的Symfony\Component\Process\PhpProcess::wait方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。