public static function executeBackground($cmd, $flags = 0x0) { $win = $flags ^ self::FORCE_UNIX && PSC::getEnvironment()->getOS() == Environment::WINDOWS; if (!$win) { throw new \Psc\Exception('Unix Implementation nicht da '); } else { $cmd = System::which('start') . ' /B ' . $cmd . ' '; return pclose(popen($cmd, 'r')); } }
/** * @return bool * @throws Exception bei Parse Errors */ public function syntaxCheck(File $file, $do = 'throw') { if (!$file->exists()) { throw new \RuntimeException('Datei ' . $file . ' existiert nicht. Syntax check nicht möglich'); } $process = new \Psc\System\Console\Process(System::which('php') . ' -l -f ' . escapeshellarg((string) $file)); $exit = $process->run(); if ($exit > 0 || $exit == -1) { if ($do === 'throw') { throw new SyntaxErrorException($process->getOutput()); } else { return FALSE; } } else { return TRUE; } }
public function testWhichNoException() { $this->assertEquals($this->notAvaibleCmd, System::which($this->notAvaibleCmd)); }