Roland van Laar
Roland van Laar

Reputation: 172

How to get fabric commands to update output in place?

Pipenv updates the commandline output in place. Fabric 1.14.0 sees every update as a new line. This results in lot of superfluous ouput.

I've read the documentation of the run operation. Tried setting capture_buffer_size to 100. Didn't make a difference.

def install_packages():
    "Install packages on the remote host."""
    with cd('/data/repo/'):
        run("pipenv install", capture_buffer_size=100)

Actual results:

[server] run: pipenv install [server] out: Creating a virtualenv for this project…
[server] out: Pipfile: /data/repo/Pipfile
[server] out: Using /usr/bin/python3.5 (3.5.2) to create virtualenv…
[server] out:
[server] out: ⠋ Creating virtual environment... [server] out: ⠙ Creating virtual environment...
[server] out: ⠹ Creating virtual environment...
[server] out: ⠸ Creating virtual environment...

......

[server] out: ✔ Successfully created virtual environment!

Expected results:

[server] run: pipenv install
[server] out: Creating a virtualenv for this project…
[server] out: Pipfile: /data/repo/Pipfile
[server] out: Using /usr/bin/python3.5 (3.5.2) to create virtualenv…
[server] out:
[server] out: ⠋ Creating virtual environment...
[server] out: ✔ Successfully created virtual environment!

Upvotes: 1

Views: 98

Answers (1)

Ismaïl Mourtada
Ismaïl Mourtada

Reputation: 472

Wrap your run("pipenv install") instruction in a with hide('output') context manager. Remove the capture_buffer_size kwarg.

More information about tuning your output can be found here

Upvotes: 0

Related Questions