コード例 #1
0
 public function test_kill()
 {
     $start = time();
     $process = Process::make(Command::make('sleep')->withArgs(5))->runAsync();
     usleep(100000);
     $process->kill();
     $this->assertLessThan(5, time() - $start);
     $this->assertEquals(SIGTERM, $process->getSignal());
 }
コード例 #2
0
ファイル: Git.php プロジェクト: sp4ceb4r/php-git
 /**
  * @param $command
  * @param array $args
  * @param array $options
  * @param array $paths
  * @param Closure $onSuccess
  * @param Closure $onError
  * @return Process
  */
 protected final function buildProcess($command, array $args = [], array $options = [], array $paths = [], Closure $onSuccess = null, Closure $onError = null)
 {
     if (in_array($command, static::$subcommands)) {
         list($command, $subcommand) = explode('-', $command);
         array_unshift($args, $subcommand);
     }
     array_unshift($args, $command);
     if (!empty($paths)) {
         $options['--'] = $paths;
     }
     $cmd = Command::make('git')->withArgs($args)->withOptions($options);
     return Process::make($cmd, $this->output)->usingCwd($this->project_dir)->onError($onError)->onSuccess($onSuccess);
 }