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


PHP Process::stop方法代码示例

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


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

示例1: stopServer

 protected static function stopServer()
 {
     if (!static::$enabled) {
         return;
     }
     self::$server->stop();
 }
开发者ID:Banjerr,项目名称:infusionWholesaler,代码行数:7,代码来源:AbstractIntegrationTest.php

示例2: run

 /**
  * @param Process $process
  * @param AdapterAbstract $testFrameworkAdapter
  * @param callable $onProgressCallback
  *
  * @return bool
  */
 public function run(Process $process, AdapterAbstract $testFrameworkAdapter, \Closure $onProgressCallback = null)
 {
     $hasFailure = false;
     $process->run(function ($out, $data) use($process, $testFrameworkAdapter, $onProgressCallback, &$hasFailure) {
         if ($out == Process::ERR) {
             $hasFailure = true;
             $process->stop();
             return;
         }
         if ($hasFailure) {
             return;
         }
         if (!$testFrameworkAdapter->ok($data)) {
             $hasFailure = true;
             $process->stop();
             return;
         }
         $oksCount = $testFrameworkAdapter->hasOks($data);
         if ($oksCount !== false && $onProgressCallback) {
             $onProgressCallback($oksCount);
         }
     });
     $process->stop();
     return $hasFailure;
 }
开发者ID:shadowhand,项目名称:humbug,代码行数:32,代码来源:ProcessRunner.php

示例3: forceStop

 /**
  * @inheritdoc
  */
 public function forceStop()
 {
     if (!$this->stopped) {
         $this->process->stop();
     }
     $this->stopped = true;
 }
开发者ID:nikita2206,项目名称:poller-symfony-process,代码行数:10,代码来源:ProcessTask.php

示例4: stop

 public function stop()
 {
     while ($this->isRunning()) {
         $this->serverProcess->stop($this->timeout, SIGINT);
         // it needs some time to stop
         usleep(10);
     }
 }
开发者ID:paq85,项目名称:WebServer,代码行数:8,代码来源:PhpBuiltInWebServer.php

示例5: stop

 protected function stop()
 {
     if ($this->background && $this->process->isRunning()) {
         $this->process->stop();
         $this->printTaskInfo("Stopped <info>" . $this->getCommand() . "</info>");
     }
 }
开发者ID:stefanhuber,项目名称:Robo,代码行数:7,代码来源:Exec.php

示例6: testResponse

 /**
  * @dataProvider cbProvider
  */
 public function testResponse($expectedStatusCode, $expectedResponseContent, $request, $testCase, $testHeaders)
 {
     $process = new Process('php -S [::1]:8999', __DIR__ . '/../../resources');
     $process->start();
     sleep(1);
     $signature = sha1($request . ServerMock::PROJECT_SECRET_KEY);
     $headers = null;
     if ($testHeaders) {
         $headers = $testHeaders;
     } else {
         $headers = array('Authorization' => 'Signature ' . $signature);
     }
     $request = $this->guzzleClient->post('/webhook_server.php?test_case=' . $testCase, $headers, $request);
     try {
         $response = $request->send();
     } catch (BadResponseException $e) {
         $process->stop();
         $response = $e->getResponse();
     }
     static::assertSame($expectedResponseContent, $response->getBody(true));
     static::assertSame($expectedStatusCode, $response->getStatusCode());
     static::assertArrayHasKey('x-xsolla-sdk', $response->getHeaders());
     static::assertSame(Version::getVersion(), (string) $response->getHeader('x-xsolla-sdk'));
     static::assertArrayHasKey('content-type', $response->getHeaders());
     if (204 === $response->getStatusCode()) {
         static::assertStringStartsWith('text/plain', (string) $response->getHeader('content-type'));
     } else {
         static::assertStringStartsWith('application/json', (string) $response->getHeader('content-type'));
     }
 }
开发者ID:apigraf,项目名称:xsolla-sdk-php,代码行数:33,代码来源:ServerTest.php

示例7: stop

 protected function stop()
 {
     if ($this->background && $this->process->isRunning()) {
         $this->process->stop();
         $this->printTaskInfo("Stopped {command}", ['command' => $this->getCommand()]);
     }
 }
开发者ID:jjok,项目名称:Robo,代码行数:7,代码来源:Exec.php

示例8: stop

 public function stop()
 {
     if ($this->background && $this->process->isRunning()) {
         $this->process->stop();
         $this->printTaskInfo("stopped <info>{$this->command}</info>");
     }
 }
开发者ID:sliver,项目名称:Robo,代码行数:7,代码来源:Exec.php

示例9: _terminate

 /**
  * Terminate current process
  * 
  * @param int $timeout
  * @param int $signal
  */
 protected function _terminate($timeout = 10, $signal = 15)
 {
     foreach ($this->_getPidRecursive($this->getPid()) as $pid) {
         posix_kill($pid, $signal);
     }
     parent::stop($timeout, $signal);
 }
开发者ID:imsamurai,项目名称:cakephp-task-plugin,代码行数:13,代码来源:TaskProcess.php

示例10: __destruct

 /**
  * Kills the connection
  */
 public function __destruct()
 {
     if ($this->output->isVerbose()) {
         $this->writeln("Closing SauceLabs tunnel.");
     }
     if (null !== $this->process) {
         $this->process->stop();
     }
 }
开发者ID:lfgamers,项目名称:sauce-connect-extension,代码行数:12,代码来源:SauceConnectExtension.php

示例11: testRequest404

 public function testRequest404()
 {
     $process = new Process((new PhpExecutableFinder())->find() . ' -S 127.0.0.1:1337 -t ' . realpath(__DIR__));
     $process->start();
     sleep(1);
     $request = new RequestProcess(new Request('GET', 'http://127.0.0.1:1337/InexistingRequest.php'));
     $this->assertEquals($request->execute(), false);
     $this->assertEquals($request->getError()['status'], 404);
     $process->stop();
 }
开发者ID:naroga,项目名称:querker,代码行数:10,代码来源:ProcessRequestTest.php

示例12: testFileDriverWithArrayArgument

 public function testFileDriverWithArrayArgument()
 {
     $fileLock = new File('lock');
     $fileLock->clearLocks();
     $p = new Process('/usr/bin/php Tests/FileLockCommand.php test:file -s 1');
     $p->start();
     $decorator = new Decorator(new TestService(), 'test_service');
     $lock = new Lock();
     $lock->setDriver($fileLock)->setMethod('sleep')->setArgumentIndex(1);
     $decorator->addLock($lock);
     $decorator->sleep(1, array(1));
     $p->stop();
     return $this->assertTrue(true);
 }
开发者ID:skafandri,项目名称:SynchronizedBundle,代码行数:14,代码来源:DecoratorTest.php

示例13: stop

 /**
  * Stops the server process
  * @link https://github.com/symfony/Process
  */
 public function stop()
 {
     if (null === $this->process) {
         return;
     }
     if (!$this->isRunning()) {
         return;
     }
     if (null !== $this->getConnection()) {
         // Force a 'clean' exit
         // See: http://stackoverflow.com/a/5266208/187954
         $this->doEvalJS($this->getConnection(), 'process.exit(0);');
         $this->process->stop();
         $this->process = null;
     }
 }
开发者ID:tillk,项目名称:vufind,代码行数:20,代码来源:Server.php

示例14: fire

 /**
  * Fire and forget a command. It will be executed asynchronously, but you can get its output via the $callback.
  * 
  * @param string $cmd Command to be fired.
  * @param callable $callback [optional] Callback function that will be called periodically during command's execution
  *                            and will take two arguments: 1st is a string buffer output and 2nd is bool error.
  *                            You can return (bool) false from the callback to stop the running command.
  */
 public function fire($cmd, $callback = null)
 {
     $process = new SymfonyProcess($cmd);
     $process->start();
     // if callback is defined then call it periodically
     if (is_callable($callback)) {
         while ($process->isRunning()) {
             // call the callback
             $continue = call_user_func_array($callback, array($process->getIncrementalOutput()));
             // if callback returned false then stop the process
             if ($continue === false) {
                 $process->stop(3, SIGINT);
             }
         }
     }
 }
开发者ID:splot,项目名称:framework-extra-module,代码行数:24,代码来源:Process.php

示例15: testClient

 public function testClient()
 {
     $process = new Process("gearman -w -f replace -- sed 's/__replace__/the best/g'");
     $process->start();
     try {
         $this->assertEquals('php is the best', $this->client->doNormal('replace', 'php is __replace__'));
         $this->assertEquals('php is the best', $this->client->doLow('replace', 'php is __replace__'));
         $this->assertEquals('php is the best', $this->client->doHigh('replace', 'php is __replace__'));
         $this->client->doBackground('replace', 'php is __replace__');
         $this->client->doHighBackground('replace', 'php is __replace__');
         $this->client->doLowBackground('replace', 'php is __replace__');
     } catch (Exception\CouldNotConnectException $e) {
         $this->markTestSkipped('Skipped, please start Gearman on port ' . Connection::DEFAULT_PORT . ' to be able to run this test');
     }
     $process->stop();
 }
开发者ID:mhlavac,项目名称:gearman,代码行数:16,代码来源:ClientTest.php


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