Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Echoing forked process output to stdout on demand #14

Closed

Conversation

Antoniossss
Copy link

Resolves #11

@mikehaertl
Copy link
Owner

@Antoniossss See schmunk42@1606eef#commitcomment-16438471. We don't want this class to echo out anything.

@mikehaertl mikehaertl closed this May 20, 2016
@Antoniossss
Copy link
Author

Antoniossss commented May 20, 2016

@mikehaertl That is why it is on demand + output is bufferer anyway.
This may be not the exact feature that has been requested, but in my case, i needed such feature - forked process is a really long running one, and live output is must be to see if everything is running smoothly.

@schmunk42
Copy link
Contributor

@Antoniossss

Here's a snippet from my code....

    public function status($name)
    {
        $command = $this->createCommand();
        $command->addArg('status');
        $command->addArg($name);

        $this->execute($command->getExecCommand());
    }

    private function execute($command)
    {
        // "real time" output
        echo $command."\n";

        $handle = popen($command, 'r');
        while (!feof($handle)) {
            echo fgets($handle);
        }
        pclose($handle);
    }

@mikehaertl
Copy link
Owner

@Antoniossss Let's continue discussion in #11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants