當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Process::close方法代碼示例

本文整理匯總了PHP中Process::close方法的典型用法代碼示例。如果您正苦於以下問題:PHP Process::close方法的具體用法?PHP Process::close怎麽用?PHP Process::close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Process的用法示例。


在下文中一共展示了Process::close方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _sendCommand

 /**
  * @param $command
  * @param $string
  */
 protected function _sendCommand($command, $string)
 {
     $process = new Process($command, $this->_globalDictionary);
     $process->write($string);
     $this->_raw = $process->read();
     $process->close();
 }
開發者ID:indynagpal,項目名稱:MateCat,代碼行數:11,代碼來源:HunspellShell.php

示例2: getTitle

 /**
  * Get the terminal title.
  * @return string
  */
 public static function getTitle()
 {
     if (!empty(self::$username)) {
         $process = new Process("uname -n");
         $title = self::$username . "@" . trim($process->get());
         $process->close();
         return $title;
     } else {
         return "not logged shell - how cold it be possible, uh?";
     }
 }
開發者ID:anonymframework,項目名稱:xwiterm,代碼行數:15,代碼來源:terminal.class.php

示例3: diff

 /**
  * Produce diff between the contents
  *
  * @param   string left
  * @param   string right
  */
 protected function diff($left, $right)
 {
     with($templ = new TempFile(), $tempr = new TempFile(), $templ->open(FILE_MODE_WRITE), $tempr->open(FILE_MODE_WRITE));
     $templ->write($left);
     $tempr->write($right);
     $templ->close();
     $tempr->close();
     // TODO: Implement "diff" in userland
     try {
         $p = new Process(sprintf('diff -u %s %s', $templ->getURI(), $tempr->getURI()));
         $p->in->close();
         while (!$p->out->eof()) {
             $this->out->writeLine($p->out->readLine());
         }
         $p->close();
     } catch (IOException $e) {
         $this->err->writeLine('!=> Invocation of `diff` program failed.');
         $templ->unlink();
         $tempr->unlink();
         return;
     }
     $templ->unlink();
     $tempr->unlink();
 }
開發者ID:Gamepay,項目名稱:xp-framework,代碼行數:30,代碼來源:DiffInstruction.class.php

示例4: json_encode

echo '<hr>';
//$p->put(chr(21));
//var_dump($p->close());
//echo json_encode($p->getStatus());
//echo '<hr>';
// $p->put("whoami");
// $p->put(chr(13));
//echo $p->get();
usleep(500000);
echo $p->get();
$p->put("whoami");
$p->put(chr(13));
echo $p->get();
echo '<hr>';
usleep(500000);
echo $p->get();
echo '<hr>';
echo json_encode($p->getStatus());
echo '<hr>';
$p->put("ls -l");
$p->put(chr(13));
echo $p->get();
echo '<hr>';
usleep(500000);
echo $p->get();
echo '<hr>';
usleep(500000);
echo $p->get();
echo '<hr>';
echo "END " . ($p->close() ? 'NOT VALID USER OR PASSWORD' : 'SUCC LOG IN');
開發者ID:kenichiii,項目名稱:online-php-ide-pfc-editor,代碼行數:30,代碼來源:wtest.php

示例5: hugeStderr

 public function hugeStderr()
 {
     $p = new Process($this->executable(), $this->arguments('-r', 'fputs(STDERR, str_repeat("*", 65536));'));
     $err = '';
     while (!$p->err->eof()) {
         $err .= $p->err->read();
     }
     $p->close();
     $this->assertEquals(65536, strlen($err));
 }
開發者ID:xp-framework,項目名稱:core,代碼行數:10,代碼來源:ProcessTest.class.php


注:本文中的Process::close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。