I am new to vagrant coming from docker.
The only issue I have encountered to far is the problematic handling of progress bars created by commands called in shell provisioners.
I am using vagrant to build the crosstool-NG toolchain which shows a progress bar (of more precisely the time elapsed plus a rotating bar). In Vagrant every update to the "progress bar" is printed in a new line. This floods the screen with useless information an prevent the user from seeing an "real" progress messages that may be interspersed with the progress bar updates.
Vagrant 2.2.1
Windows 8.1
Microsoft Windows [Version 6.3.9600]
debian/contrib-jessie64
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "debian/contrib-jessie64"
config.vm.provider "virtualbox" do |vb|
vb.memory = "256"
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "98"]
vb.linked_clone = true if Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('1.8.0')
end
config.vm.provision "shell", inline: <<-SHELL
set -e
apt-get update
apt-get install -y git
apt-get install -y make autoconf gcc libc-dev g++ gperf bison flex texinfo wget bzip2 help2man gawk libtool-bin ncurses-dev python-dev
apt-get install -y unzip
SHELL
config.vm.provision "shell", privileged: false, inline: <<-SHELL
set -e
git clone --recursive https://github.com/pfalcon/esp-open-sdk
cd esp-open-sdk
make toolchain
SHELL
end
=== Last debug message printed ===
[31:54] - t:
Only a single line of the progress bar should be printed. This line should be updated. (Overwritten.)
[31:23] | t:
[31:24] | t:
[31:24] | t:
[31:27] | t:
[31:27] / t:
[31:27] / t:
[31:31] / t:
[31:31] / t:
[31:32] / t:
[31:34] / t:
[31:35] / t:
[31:36] / t:
[31:38] / t:
[31:39] / t:
[31:40] - t:
[31:43] - t:
[31:43] - t:
[31:47] - t:
[31:47] - t:
[31:48] - t:
[31:50] - t:
[31:51] - t:
[31:51] - t:
[31:54] - t:
vagrant up with vagrantfile provided aboveHi there. This is simply streaming the output from the commands you are running on the guest. To prevent things like progress bars from being streamed, you need to add --quiet flags to your commands (or what ever flag is used to suppress output for the given command in use).
Cheers!
@chrisroberts Thanks for getting back to me. Your answer is apparently mistaken though:
This is simply streaming the output from the commands you are running on the guest.
The problem is that quite clearly vagrant is not simply streaming the output. Instead it seems to insert a line-break character \n after every output from the command. - Even if the command did not output one.
This seems to be at the core of why so many people are reporting issues with progress bars with vagrant. Ascii progress bars work fundamentally by not ending a output line with \n but staying in the line last printed instead. Thus when the command printing the progress bar issues an update, it begins the line-update with \r (carriage return) to overwrite the current line instead. By inserting \n after every line output, vagrant breaks this process of all ascii progress bars.
Please re-open this issue as either as a bug or feature request: Your recommendation to modify the script is not reasonable in many cases. It works well if you directly control the command that prints the progress bar. But what if it is printed by a command in a script, called by a script, ......., called by a script you called? Messing with Makefiles of highly intricate but well-established open source projects is not really a sensible approach to circumventing this bug.
+1 for this feature.
Another way to reproduce:
$script = <<-SCRIPT
openssl genrsa -out /tmp/server.key 2048
SCRIPT
Vagrant.configure("2") do |config|
config.vm.box = "base"
config.vm.provision "shell", inline: $script
end
After a vagrant up, I got:
==> default: Running provisioner: shell...
default: Running: inline script
default: Generating RSA private key, 2048 bit long modulus
default: ....
default: .............
default: ............
default: ..............
default: ........+++
default: ....
default: .............
default: .+++
default: e is 65537 (0x10001)
@chrisroberts: any idea of a possible workaround for this issue ?
Most helpful comment
@chrisroberts Thanks for getting back to me. Your answer is apparently mistaken though:
The problem is that quite clearly vagrant is not simply streaming the output. Instead it seems to insert a line-break character
\nafter every output from the command. - Even if the command did not output one.This seems to be at the core of why so many people are reporting issues with progress bars with vagrant. Ascii progress bars work fundamentally by not ending a output line with
\nbut staying in the line last printed instead. Thus when the command printing the progress bar issues an update, it begins the line-update with\r(carriage return) to overwrite the current line instead. By inserting\nafter every line output, vagrant breaks this process of all ascii progress bars.Please re-open this issue as either as a bug or feature request: Your recommendation to modify the script is not reasonable in many cases. It works well if you directly control the command that prints the progress bar. But what if it is printed by a command in a script, called by a script, ......., called by a script you called? Messing with Makefiles of highly intricate but well-established open source projects is not really a sensible approach to circumventing this bug.