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

Disable globally progress bar #674

Open
rklak opened this issue Jan 31, 2018 · 5 comments
Open

Disable globally progress bar #674

rklak opened this issue Jan 31, 2018 · 5 comments

Comments

@rklak
Copy link

rklak commented Jan 31, 2018

Is there a way to globally disable the progress bar?

Example screens with ugly progress bar:
screenshot from 2018-01-31 09-01-09

screenshot from 2018-01-31 10-42-41

Example script with taskParallelExec, but its jus an example task

public function validationFull()
    {
        return $this
            ->taskParallelExec()
            ->process('composer validation:phpunit')
            ->process('composer validation:behat')
            ->process('composer validation:coding-standard')
            ->process('composer validation:mess-detect')
            ->run();
    }

I would like to disable progress bar at all, because its not readable to me in the way it is implemented.

@rklak
Copy link
Author

rklak commented Mar 9, 2018

Any chance to achieve this?

@greg-1-anderson
Copy link
Member

I am in favor of improving / disabling the progress bar as desired. When using the logger to output, Robo automatically hides/shows the progress bar around the output, so the stale progress bar image is not left behind. Other code that also outputs, e.g. taskExec et. al., also need to do this operation.

It would also be valuable to have an option to simply disable the progress bar for whatever reason. The workaround for doing this is to set the progress display delay to a very large value. For example:

$ ./robo try:progress --progress-delay=99999
➜  Progress bar will display after 99999 seconds of activity.
 [Progress] Processing 1
 [Progress] Processing 2
 [Progress] Processing 3
 [Progress] Processing 4
 [Progress] Processing 5
 [Progress] Processing 6
 [Progress] Processing 7
 [Progress] Processing 8
 [Progress] Processing 9
 [Progress] Processing 10

Or do this permanently in your robo.yml:

options:
  progress-delay: 99999

If Robo implemented EnvConfig (easy -- it just happens not to), then it would also be possible to set an environment variable:

ROBO_OPTIONS_PROGRESS_DELAY=99999 ./robo try:progress

That at present does not do anything, though.

A pull request to add a separate disable option, or implement EnvConfig, or improve the output of the progress bar would be welcome. I haven't had time to get to these things myself as of yet.

@jkribeiro
Copy link

Robo 3.0

In my case, even using progress delay option, I'm still having progress output using taskExec

 [Exec] Running ln -s /efs/testsite/dev/files/private /site/private-files
 [Exec] Done in 0.003s
   19 [============================]

@jkribeiro
Copy link

So, it seems that the progress bar is displayed even for systems that does not support TTY. Here, I'm using alpine linux for an github actions build:

Run robo --load-from /root/RoboFile.php --progress-delay=99999 phpcs:coder ${GITHUB_WORKSPACE}
 [Composer\RequireDependency] Requiring packages: /usr/local/bin/composer require drupal/coder --no-interaction
    0 [>---------------------------]

    4 [->--------------------------] [Exec] Running phpcs --standard=Drupal --extensions=inc,install,module,php,profile,test,theme --ignore=\.conf,\.css,\.js,\.md,\.txt,config/*,content/*,core/* --warning-severity=0 --colors /__w/pftest01_profile/pftest01_profile -d date.timezone=UTC
 [Exec] Done in 0.139s


[SUCCESS] Success! No Drupal standards violations found.
    6 [--->------------------------]

The progress is messing with the logs.

@greg-1-anderson I would love to create a PR for this. What is your thought about it, should we create an option to disable the progress globally, or try to determine if the system supports progress or not (not sure how to do this, TBH). Thanks

@greg-1-anderson
Copy link
Member

Yeah, auto-disabling the progress bar when tty mode is not available is a good idea. You can detect tty mode with posix_isatty. This function is not available on some systems (e.g. Windows), so you'll need to guard it with a function_exists. Off the top of my head, I'm not sure the best place to insert this switch. PRs welcome.

The workaround is to just define ROBO_OPTIONS_PROGRESS_DELAY in your CI's variables page.

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