protected function handleProcessOutput(
        array $processInfo,
        BufferedOutputInterface $output,
        callable $processTerminatedCallback
    ) {
        // Get the process.
        /** @var Process $process */
        $process = $processInfo['process'];

        // Get the project.
        /** @var Project $project */
        $project = $processInfo['project'];

        // Start the process if not already started.
        if (!$process->isStarted()) {
            $process->start();
        }

        // Get the last output from the process.
        $incrementalOutput = $this->getIncrementalProcessOutput($process);

        $this->workaroundForSingleChar(
            $incrementalOutput,
            $project
        );

        // Show the output.
        if ($incrementalOutput != '') {
            // Dispatch an event.
            $this->dispatcher->dispatch(
                IncrementalOutputReceivedEvent::NAME,
                new IncrementalOutputReceivedEvent(
                    $incrementalOutput,
                    $project,
                    $process
                )
            );

            if ($output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) {
                if ($project->getForegroundColor() <= 0) {
                    $output->write(
                        sprintf(
                            '%s:' . "\t" . '%s',
                            $project->getName(),
                            $incrementalOutput
                        )
                    );
                } else {
                    if ($this->writtenToBuffer) {
                        $output->write("\n");
                    }

                    $projectName = sprintf(
                        "\033[38;5;%dm%s:\033[0m",
                        $project->getForegroundColor(),
                        $project->getName()
                    );

                    if (!empty($project->getBackgroundColor())) {
                        $projectName = sprintf(
                            "\033[38;5;%dm%s:\033[0m",
                            $project->getBackgroundColor(),
                            $project->getName()
                        );

                        $projectOutput = sprintf(
                            "\t\033[38;5;%dm\033[48;5;%dm%s\033[0m",
                            $project->getForegroundColor(),
                            $project->getBackgroundColor(),
                            $incrementalOutput
                        );
                    } else {
                        $projectOutput = sprintf(
                            "\t%s",
                            $incrementalOutput
                        );
                    }

                    $output->write(
                        sprintf(
                            '%s%s',
                            $projectName,
                            $projectOutput
                        )
                    );
                    $this->writtenToBuffer = true;
                }
            }
        }


        if ($process->isTerminated()) {
            $processTerminatedCallback();
        }
    }
protected function handleProcessOutput(
        array $processInfo,
        BufferedOutputInterface $output,
        callable $processTerminatedCallback
    ) {
        // Get the process.
        /** @var Process $process */
        $process = $processInfo['process'];

        // Get the project.
        /** @var Project $project */
        $project = $processInfo['project'];

        // Start the process if not already started.
        if (!$process->isStarted()) {
            $process->start();
        }

        // Get the last output from the process.
        $incrementalOutput = $this->getIncrementalProcessOutput($process);

        $this->workaroundForSingleChar(
            $incrementalOutput,
            $project
        );

        // Show the output.
        if ($incrementalOutput != '') {
            // Dispatch an event.
            $this->dispatcher->dispatch(
                IncrementalOutputReceivedEvent::NAME,
                new IncrementalOutputReceivedEvent(
                    $incrementalOutput,
                    $project,
                    $process
                )
            );

            if ($output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) {
                if ($project->getForegroundColor() <= 0) {
                    $output->write(
                        sprintf(
                            '%s:' . "\t" . '%s',
                            $project->getName(),
                            $incrementalOutput
                        )
                    );
                } else {
                    if ($this->writtenToBuffer) {
                        $output->write("\n");
                    }

                    $projectName = sprintf(
                        "\033[38;5;%dm%s:\033[0m",
                        $project->getForegroundColor(),
                        $project->getName()
                    );

                    if (!empty($project->getBackgroundColor())) {
                        $projectName = sprintf(
                            "\033[38;5;%dm%s:\033[0m",
                            $project->getBackgroundColor(),
                            $project->getName()
                        );

                        $projectOutput = sprintf(
                            "\t\033[38;5;%dm\033[48;5;%dm%s\033[0m",
                            $project->getForegroundColor(),
                            $project->getBackgroundColor(),
                            $incrementalOutput
                        );
                    } else {
                        $projectOutput = sprintf(
                            "\t%s",
                            $incrementalOutput
                        );
                    }

                    $output->write(
                        sprintf(
                            '%s%s',
                            $projectName,
                            $projectOutput
                        )
                    );
                    $this->writtenToBuffer = true;
                }
            }
        }


        if ($process->isTerminated()) {
            $processTerminatedCallback();
        }
    }
protected function handleProcessOutput ( array $ processInfo , BufferedOutputInterface $ output , callable $ processTerminatedCallback ) { // Get the process. /** @var Process $process */ $ process = $ processInfo [ 'process' ] ; // Get the project. /** @var Project $project */ $ project = $ processInfo [ 'project' ] ; // Start the process if not already started. if ( ! $ process -> isStarted ( ) ) { $ process -> start ( ) ; } // Get the last output from the process. $ incrementalOutput = $ this -> getIncrementalProcessOutput ( $ process ) ; $ this -> workaroundForSingleChar ( $ incrementalOutput , $ project ) ; // Show the output. if ( $ incrementalOutput != '' ) { // Dispatch an event. $ this -> dispatcher -> dispatch ( IncrementalOutputReceivedEvent :: NAME , new IncrementalOutputReceivedEvent ( $ incrementalOutput , $ project , $ process ) ) ; if ( $ output -> getVerbosity ( ) >= OutputInterface :: VERBOSITY_NORMAL ) { if ( $ project -> getForegroundColor ( ) <= 0 ) { $ output -> write ( sprintf ( '%s:' . "\t" . '%s' , $ project -> getName ( ) , $ incrementalOutput ) ) ; } else { if ( $ this -> writtenToBuffer ) { $ output -> write ( "\n" ) ; } $ projectName = sprintf ( "\033[38;5;%dm%s:\033[0m" , $ project -> getForegroundColor ( ) , $ project -> getName ( ) ) ; if ( ! empty ( $ project -> getBackgroundColor ( ) ) ) { $ projectName = sprintf ( "\033[38;5;%dm%s:\033[0m" , $ project -> getBackgroundColor ( ) , $ project -> getName ( ) ) ; $ projectOutput = sprintf ( "\t\033[38;5;%dm\033[48;5;%dm%s\033[0m" , $ project -> getForegroundColor ( ) , $ project -> getBackgroundColor ( ) , $ incrementalOutput ) ; } else { $ projectOutput = sprintf ( "\t%s" , $ incrementalOutput ) ; } $ output -> write ( sprintf ( '%s%s' , $ projectName , $ projectOutput ) ) ; $ this -> writtenToBuffer = true ; } } } if ( $ process -> isTerminated ( ) ) { $ processTerminatedCallback ( ) ; } }
Handles the output for a process.

@param array $processInfo The process information.
@param \Para\Service\Output\BufferedOutputInterface $output
@param callable $processTerminatedCallback
Handles the output for a process .