當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。