/** * 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; }
/** * 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; }