Beispiel #1
0
 static function cmd($cmd, $passthru = false)
 {
     if (ini::get('verbose') >= 1) {
         echo $cmd . ($passthru ? ' (passthru)' : '') . "\n";
     }
     // passthru (raw output gets echoed)
     if ($passthru === true or $passthru === 'passthru') {
         passthru($cmd, self::$cmdStatus);
     } elseif ($passthru === 'spawn') {
         $ret = proc_open("{$cmd} &", array(), $foo);
         //proc_close($ret);
         return $ret;
     } else {
         exec($cmd, $output, self::$cmdStatus);
         return ra::condense($output, "\n");
     }
 }
Beispiel #2
0
 static function parse($fname, $args)
 {
     $msg = explode("\n", funx::inc($fname, $args));
     $subject = trim(array_shift($msg));
     $body = ra::condense($msg, '<br />');
     return array($subject, $body);
 }
Beispiel #3
0
 protected static function strip($ret)
 {
     // erase tabs
     $ret = str_replace(array("\t"), array(''), $ret);
     // strip c++ style comments
     $lines = explode("\n", $ret);
     foreach ($lines as $i => $line) {
         if (($pos = strpos($line, '/' . '/')) !== false) {
             $lines[$i] = substr($line, 0, $pos);
         }
     }
     $ret = ra::condense($lines, "") . "\n";
     return $ret;
 }