简体   繁体   中英

Symfony console ProgressBar component is not displayed in composer scripts

Using the ProgressBar component in a command called by a composer script has no effect as the ProgressBar output is not shown.

Why is this? Is there a way to enforce its rendering?


Update: Now (since upgrade to symfony 2.6) it is shown, but the console refresh doesn't work correctly and for each update is adds a new line...

Make sure that you're using a up-to-date version of the component. Check if the bar works correct with the following snippet:

<?php
$max=10;
$progress = new ProgressBar($output, $max);
$progress->start();

for ($i = 0; $i <= $max; ++$i) {
 sleep(1);
 $progress->advance();
}
$progress->finish();

If this is the case, the task you execute between every $progress->advance(); step seems to write something to output which makes the bar be redrawn on every step.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM