public function run(Input $input, OutputInterface $output)
    {
        $this->eventDispatcher->dispatch(new ExerciseRunnerEvent('cgi.run.start', $this->exercise, $input));
        $success = true;
        foreach ($this->exercise->getRequests() as $i => $request) {
            $event = $this->eventDispatcher->dispatch(
                new CgiExecuteEvent('cgi.run.student-execute.pre', $request)
            );
            $process = $this->getProcess($input->getArgument('program'), $event->getRequest());

            $output->writeTitle("Request");
            $output->emptyLine();
            $output->write($this->requestRenderer->renderRequest($request));

            $output->writeTitle("Output");
            $output->emptyLine();
            $process->start();
            $this->eventDispatcher->dispatch(
                new CgiExecuteEvent('cgi.run.student.executing', $request, ['output' => $output])
            );
            $process->wait(function ($outputType, $outputBuffer) use ($output) {
                $output->write($outputBuffer);
            });
            $output->emptyLine();

            if (!$process->isSuccessful()) {
                $success = false;
            }

            $output->lineBreak();
        }
        $this->eventDispatcher->dispatch(new ExerciseRunnerEvent('cgi.run.finish', $this->exercise, $input));
        return $success;
    }
public function run(Input $input, OutputInterface $output)
    {
        $this->eventDispatcher->dispatch(new ExerciseRunnerEvent('cgi.run.start', $this->exercise, $input));
        $success = true;
        foreach ($this->exercise->getRequests() as $i => $request) {
            $event = $this->eventDispatcher->dispatch(
                new CgiExecuteEvent('cgi.run.student-execute.pre', $request)
            );
            $process = $this->getProcess($input->getArgument('program'), $event->getRequest());

            $output->writeTitle("Request");
            $output->emptyLine();
            $output->write($this->requestRenderer->renderRequest($request));

            $output->writeTitle("Output");
            $output->emptyLine();
            $process->start();
            $this->eventDispatcher->dispatch(
                new CgiExecuteEvent('cgi.run.student.executing', $request, ['output' => $output])
            );
            $process->wait(function ($outputType, $outputBuffer) use ($output) {
                $output->write($outputBuffer);
            });
            $output->emptyLine();

            if (!$process->isSuccessful()) {
                $success = false;
            }

            $output->lineBreak();
        }
        $this->eventDispatcher->dispatch(new ExerciseRunnerEvent('cgi.run.finish', $this->exercise, $input));
        return $success;
    }
public function run ( Input $ input , OutputInterface $ output ) { $ this -> eventDispatcher -> dispatch ( new ExerciseRunnerEvent ( 'cgi.run.start' , $ this -> exercise , $ input ) ) ; $ success = true ; foreach ( $ this -> exercise -> getRequests ( ) as $ i => $ request ) { $ event = $ this -> eventDispatcher -> dispatch ( new CgiExecuteEvent ( 'cgi.run.student-execute.pre' , $ request ) ) ; $ process = $ this -> getProcess ( $ input -> getArgument ( 'program' ) , $ event -> getRequest ( ) ) ; $ output -> writeTitle ( "Request" ) ; $ output -> emptyLine ( ) ; $ output -> write ( $ this -> requestRenderer -> renderRequest ( $ request ) ) ; $ output -> writeTitle ( "Output" ) ; $ output -> emptyLine ( ) ; $ process -> start ( ) ; $ this -> eventDispatcher -> dispatch ( new CgiExecuteEvent ( 'cgi.run.student.executing' , $ request , [ 'output' => $ output ] ) ) ; $ process -> wait ( function ( $ outputType , $ outputBuffer ) use ( $ output ) { $ output -> write ( $ outputBuffer ) ; } ) ; $ output -> emptyLine ( ) ; if ( ! $ process -> isSuccessful ( ) ) { $ success = false ; } $ output -> lineBreak ( ) ; } $ this -> eventDispatcher -> dispatch ( new ExerciseRunnerEvent ( 'cgi.run.finish' , $ this -> exercise , $ input ) ) ; return $ success ; }
Runs a student's solution by invoking PHP via the `php-cgi` binary, populating all the super globals with
the information from the request objects returned from the exercise. The exercise can return multiple
requests so the solution will be invoked for however many requests there are.

Running only runs the student's solution, the reference solution is not run and no verification is performed,
the output of the student's solution is written directly to the output.

Events dispatched (for each request):

* cgi.run.student-execute.pre
* cgi.run.student.executing

@param Input $input The command line arguments passed to the command.
@param OutputInterface $output A wrapper around STDOUT.
@return bool If the solution was successfully executed, eg. exit code was 0.
Runs a student s solution by invoking PHP via the php - cgi binary populating all the super globals with the information from the request objects returned from the exercise . The exercise can return multiple requests so the solution will be invoked for however many requests there are .