consolidation / robo

Modern task runner for PHP
http://robo.li
Other
2.66k stars 305 forks source link

taskExec should automatically hide and re-show the progress bar #647

Open rklak opened 6 years ago

rklak commented 6 years ago

Steps to reproduce

Add tasks to the collection Watch the output oafter the progress bar for each task

Expected behavior

The output of each task should start from the new line or there should be option to disable progress bar (In my case I dont need it)

Actual behavior

Progress bar and task output are in the same line.

System Configuration

Ubuntu 16.04 / PHP 5.6

I have site based on symfony. And when I run collection tasks, the progress bar brokes the output of each task: screenshot from 2017-11-16 21-57-25

The task output is written right after the progress bar of collection. It should start from a new line. Maybe it will be better to disable the progress bar by some option?

greg-1-anderson commented 6 years ago

Are you using $this->io()->write or something of that nature to output "Dropping database schema..." et. al., or are you calling some library that is printing those messages?

If you are printing from your tasks, you should instead use $this->logger->notice("...") to display your progress messages. That will automatically hide and then re-display the progress bar.

rklak commented 6 years ago

I use native task from symfony. I dont change them. I just run taskExec in my collection. Droping databse schema comes from symfony bin/console doctrine:schema:drop https://symfony.com/doc/current/doctrine.html#doctrine-creating-the-database-tables-schema

greg-1-anderson commented 6 years ago

Got it. taskExec should automatically hide and re-show the progress bar.

rklak commented 6 years ago

Anyway is there an option to disable the progress bar in collection? I cant find it in documentation.

greg-1-anderson commented 6 years ago

If you'd like to make a PR, just call hideProgressIndicator() and showProgressIndicator() in taskExec. If you implement ProgressIndicatorAwareInterface and use ProgressIndicatorAwareTrait, then dependency injection should be done for you automatically.