コード例 #1
0
 /**
  * @test
  */
 public function runLocalCommandasUser()
 {
     try {
         $testfile = tempnam(sys_get_temp_dir(), __FUNCTION__);
         $command = new Command(new LocalConnection(), 'whoami > ' . $testfile, 'root');
         $command->exec();
         $this->assertEquals('root', trim(file_get_contents($testfile)));
         unlink($testfile);
     } catch (\Exception $e) {
         $this->markTestSkipped('It is ok if this test fails');
     }
 }
コード例 #2
0
ファイル: Connection.php プロジェクト: AOEpeople/AwsInspector
 /**
  * Execute command on this connection
  *
  * @param string $command
  * @return array
  */
 public function exec($command)
 {
     $command = new Command($this, $command);
     return $command->exec();
 }
コード例 #3
0
 /**
  * Execute command on this connection
  *
  * @param string $command
  * @param string $asUser
  * @return array
  */
 public function exec($command, $asUser = null)
 {
     $command = new Command($this, $command, $asUser);
     return $command->exec();
 }