/** * @throws ScribuntoException */ protected function checkStatus() { $this->checkValid(); $status = proc_get_status($this->proc); if (!$status['running']) { wfDebug(__METHOD__ . ": not running\n"); proc_close($this->proc); $this->proc = false; if ($status['signaled']) { $this->exitError = $this->engine->newException('scribunto-luastandalone-signal', array('args' => array($status['termsig']))); } elseif (defined('SIGXCPU') && $status['exitcode'] == 128 + SIGXCPU) { $this->exitError = $this->engine->newException('scribunto-common-timeout'); } else { $this->exitError = $this->engine->newException('scribunto-luastandalone-exited', array('args' => array($status['exitcode']))); } throw $this->exitError; } }
/** * @throws ScribuntoException */ protected function handleIOError() { $this->checkValid(); proc_terminate($this->proc); $wstatus = proc_close($this->proc); $signaled = pcntl_wifsignaled($wstatus); $termsig = pcntl_wtermsig($wstatus); $exitcode = pcntl_wexitstatus($wstatus); $this->proc = false; if ($signaled) { if (defined('SIGXCPU') && $termsig == SIGXCPU) { $this->exitError = $this->engine->newException('scribunto-common-timeout'); } else { $this->exitError = $this->engine->newException('scribunto-luastandalone-signal', array('args' => array($termsig))); } } else { $this->exitError = $this->engine->newException('scribunto-luastandalone-exited', array('args' => array($exitcode))); } throw $this->exitError; }