execute(); $process->execute(); }); } public function testIsRunning() { Loop::run(function() { $process = new Process("exit 42"); $promise = $process->execute(); $this->assertTrue($process->isRunning()); yield $promise; $this->assertFalse($process->isRunning()); }); } public function testExecuteResolvesToExitCode() { Loop::run(function() { $process = new Process("exit 42"); $code = yield $process->execute(); $this->assertSame(42, $code); $this->assertFalse($process->isRunning()); }); } public function testCommandCanRun() { Loop::run(function() { $process = new Process(self::CMD_PROCESS); $promise = $process->execute(); $completed = false; $promise->when(function() use (&$completed) { $completed = true; }); $this->assertFalse($completed); $this->assertInternalType('int', $process->getPid()); }); } /** * @expectedException \Amp\Process\ProcessException * @expectedExceptionMessage The process was killed */ public function testKillSignals() { Loop::run(function() { $process = new Process(self::CMD_PROCESS); $promise = $process->execute(); $process->kill(); $code = yield $promise; }); } public function testCommand() { $process = new Process(self::CMD_PROCESS); $this->assertSame(self::CMD_PROCESS, $process->getCommand()); } public function testOptions() { $process = new Process(self::CMD_PROCESS); $this->assertSame([], $process->getOptions()); } }