Exemple #1
0
 /**
  * @memcheck
  */
 public function testExecExtended()
 {
     $cmd = (string) "sleep 0.1; echo \$_ION_EXEC_LINE;";
     $this->promise(function () use($cmd) {
         $res = (yield Process::exec($cmd, ['user' => (string) 'www', 'set_group' => true, 'pid' => &$this->data['pid']]));
         $this->data['instance'] = get_class($res);
         return (array) $res;
     });
     $this->loop();
     $this->assertEquals('ION\\Process\\Exec', $this->data['instance']);
     $this->assertEquals($cmd, $this->data['result']['command']);
     $this->assertTrue(is_integer($this->data['result']['pid']));
     $this->assertTrue(is_integer($this->data['pid']));
     $this->assertEquals($this->data['result']['pid'], $this->data['pid']);
     $this->assertStringMatchesFormat(__FILE__ . ":%i", trim($this->data['result']['stdout']));
 }