Beispiel #1
0
 public function testKill()
 {
     $t0 = microtime(true);
     $child = Process::fork(function () {
         \usleep(0.1 * 1000 * 1000);
     });
     $child->kill();
     $st = 0;
     $wpid = \pcntl_wait($st);
     $t1 = microtime(true);
     $this->assertEquals($wpid, $child->getPid());
     $this->assertLessThan(0.05, $t1 - $t0);
 }
Beispiel #2
0
 public function testSendSignal_Failed()
 {
     $child = Process::fork(function () {
         \usleep(0.1 * 1000 * 1000);
     });
     $errorSignal = 1001;
     try {
         $child->sendSignal($errorSignal);
     } catch (\Exception $ex) {
         $this->assertTrue($ex instanceof FailToSendSignalException);
     }
     \pcntl_wait($st);
 }