Пример #1
0
 /**
  * Gets the string representation of the instance.
  *
  * @return string
  */
 public function toString()
 {
     $ret = SysCmdHelper::escapeCmd($this->command);
     foreach ($this->args as $arg) {
         $ret .= " " . $arg->toString();
     }
     return $ret;
 }
Пример #2
0
 /**
  * Is a process running?
  *
  * Checks if a process is still running.
  *
  * @param integer $pid Process identifier
  *
  * @return boolean
  */
 public static function isRunning($pid)
 {
     try {
         $result = shell_exec("ps " . SysCmdHelper::escape($pid));
         if (count(preg_split("/\n/", $result)) > 2) {
             return true;
         }
     } catch (Exception $e) {
         // ignore exception
     }
     return false;
 }
Пример #3
0
 /**
  * Gets the string representation of the instance.
  *
  * @return string
  */
 public function toString()
 {
     $ret = $this->_name ? "-" . SysCmdHelper::escape($this->_name) : null;
     if (!TextHelper::isEmpty($this->_value)) {
         $value = $this->_value;
         if (!$this->_isRaw) {
             $value = SysCmdHelper::escape($value);
         }
         $ret = TextHelper::concat(" ", $ret, $value);
     }
     return $ret;
 }