I use in a simple command task with Symfony2 (2.6.6).
My code looks like this:
... $progress = new ProgressBar($output, $total); $progress->start(); if (($handler = fopen($file, "r")) !== FALSE) { while (($row = fgetcsv($handler, 1000, ",")) !== FALSE) { $this->whatever(); $progress->advance(); } fclose($handler); $progress->finish(); } ...
And the result is as follows:
0/50 [>---------------------------] 0% 5/50 [==>-------------------------] 10% 10/50 [=====>----------------------] 20% 15/50 [========>-------------------] 30% 20/50 [===========>----------------] 40% 25/50 [==============>-------------] 50% 30/50 [================>-----------] 60% 35/50 [===================>--------] 70% 40/50 [======================>-----] 80% 45/50 [=========================>--] 90% 50/50 [============================] 100
The progress bar does not restart, appears in a new line with each ->advance() . I am sure that the function ->whatever(); does nothing with the exit.
Does anyone know why this behavior? Thank you!
sorry for my English
source share