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

Output getting buffered when running via command line #1792

Closed
fijas opened this issue Mar 5, 2019 · 1 comment
Closed

Output getting buffered when running via command line #1792

fijas opened this issue Mar 5, 2019 · 1 comment

Comments

@fijas
Copy link
Contributor

fijas commented Mar 5, 2019

When running methods via CLI, output buffering is on.

Eg:

public function test() {
    for($i = 0; $i <= 10; $i++) {
        echo $i; sleep(2);
    }
}

this function prints the output all at once after running instead of printing with a 2 second delay. Adding ob_end_flush() outputs the result as expected. I don't think this is the expected behavior for CLI methods?

CI version: 4.0.0-beta1
PHP Version: 7.2.x

@jim-parry jim-parry added this to the 4.0.0-beta.2 milestone Mar 5, 2019
@lonnieezell
Copy link
Member

lonnieezell commented Mar 13, 2019

If you use the functions in the CLI library, it works as you would expect.

public function test() {
    for($i = 0; $i <= 10; $i++) {
        CLI::write($i); sleep(2);
    }
}

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

No branches or pull requests

3 participants