piotrmurach / tty-progressbar Goto Github PK
View Code? Open in Web Editor NEWDisplay a single or multiple progress bars in the terminal.
Home Page: https://ttytoolkit.org
License: MIT License
Display a single or multiple progress bars in the terminal.
Home Page: https://ttytoolkit.org
License: MIT License
Using Unicode in the complete
option breaks it with a negative array size
error.
# encoding: UTF-8
# frozen_string_literal: true
require 'tty-progressbar'
p = TTY::ProgressBar.new(':title [:bar] :percent :eta',
incomplete: '〜',head: '語',complete: '本',total: 100,width: 33)
p.start()
0.upto(5) do
sleep(1)
p.advance(3)
end
p.finish()
It will produce this error:
Traceback (most recent call last):
...
9: from ~/.gem/ruby/2.7.0/gems/tty-progressbar-0.17.0/lib/tty/progressbar.rb:360:in `finish'
8: from ~/.gem/ruby/2.7.0/gems/tty-progressbar-0.17.0/lib/tty/progressbar.rb:284:in `render'
7: from ~/.rubies/ruby-2.7.0/lib/ruby/2.7.0/forwardable.rb:235:in `decorate'
6: from ~/.gem/ruby/2.7.0/gems/tty-progressbar-0.17.0/lib/tty/progressbar/pipeline.rb:34:in `decorate'
5: from ~/.gem/ruby/2.7.0/gems/tty-progressbar-0.17.0/lib/tty/progressbar/pipeline.rb:34:in `inject'
4: from ~/.gem/ruby/2.7.0/gems/tty-progressbar-0.17.0/lib/tty/progressbar/pipeline.rb:34:in `each'
3: from ~/.gem/ruby/2.7.0/gems/tty-progressbar-0.17.0/lib/tty/progressbar/pipeline.rb:37:in `block in decorate'
2: from ~/.gem/ruby/2.7.0/gems/tty-progressbar-0.17.0/lib/tty/progressbar/formatter/bar.rb:48:in `format'
1: from ~/.gem/ruby/2.7.0/gems/tty-progressbar-0.17.0/lib/tty/progressbar/formatter/bar.rb:48:in `new'
~/.gem/ruby/2.7.0/gems/tty-progressbar-0.17.0/lib/tty/progressbar/formatter/bar.rb:48:in `initialize': negative array size (ArgumentError)
If you change complete
to English, it works fine.
I am not sure whether it is a frequent use case, but I've thought that iterate
is exact match for it... But it isn't.
Imagine this:
sleepy = Enumerator.new { |y|
loop do
do_something
sleep(10)
end
}
# Now, each call of sleepy.next does something, then sleeps. And it is forever!
# The reasonable usage is like:
partial_result = sleepy.take(10)
# Now, I expected that this is "natural":
partial_result = TTY::ProgressBar.new('[:bar:]').iterate(sleepy).to_a
...but, as iterate
tries to get collection's count, everything goes sideways here. Probably, having an optional total_count
argument could be useful?
I'm using the multi and it works great. However, I'm wondering if it would be possible to add support for centered, overlay text? For example, I have a pipeline with many steps, however, some of them can be skipped and I'd like to denote that in the progress. Something like this:
# ┌ main [■■■■■■■■■■■■■□□□□□□□□□□] 50%
# ├── one [■■■■■■■■Skipped■■■■■■■■] 100%
# └── two [■■■■■■■■■■■■□□□□□□□□□□□] 50%
If this capability doesn't already exist, there would need to be a new method which performs the action with the text input. Something like:
progress_bar_download.overlay('Skipped', align: :center)
This may be too tedious to implement.
Originally from here #31.
Currently it seems like color codes increase length further than it should be, which causes some unexpected behavior as described in the pr.
Opening this to track the solution
Hi, it's me again :D
I'd just like to kindly suggest that having a file named lib/tty-progressbar.rb
is an anti-pattern, and also, a class called ProgressBar
should be in a file called progress_bar.rb
not progressbar.rb
. Additionally, rather than overloading progress bar to be a spinner, you might want to have an entirely separate class. I think it's a nicer design.
Just some general feedback. Really useful gem.
Running the progress bar from the example docs. Resize the terminal while the progress is going.
Tried iTerm and OSX terminal, same result.
~/.rubies/ruby-2.1.6/lib/ruby/2.1.0/monitor.rb:246:in `mon_check_owner': current thread not owner (ThreadError)
from ~/.rubies/ruby-2.1.6/lib/ruby/2.1.0/monitor.rb:195:in `mon_exit'
from ~/.rubies/ruby-2.1.6/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:143:in `ensure in require'
from ~/.rubies/ruby-2.1.6/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:143:in `require'
from ~/.gem/ruby/2.1.6/gems/tty-screen-0.5.0/lib/tty/screen/size.rb:47:in `try_io_console'
from ~/.gem/ruby/2.1.6/gems/tty-screen-0.5.0/lib/tty/screen/size.rb:38:in `from_io_console'
from ~/.gem/ruby/2.1.6/gems/tty-screen-0.5.0/lib/tty/screen/size.rb:22:in `size'
from ~/.gem/ruby/2.1.6/gems/tty-screen-0.5.0/lib/tty/screen.rb:45:in `size'
from ~/.gem/ruby/2.1.6/gems/tty-screen-0.5.0/lib/tty/screen.rb:26:in `size'
from ~/.gem/ruby/2.1.6/gems/tty-screen-0.5.0/lib/tty/screen.rb:31:in `width'
from ~/.gem/ruby/2.1.6/gems/tty-progressbar-0.8.0/lib/tty/progressbar.rb:266:in `max_columns'
from ~/.gem/ruby/2.1.6/gems/tty-progressbar-0.8.0/lib/tty/progressbar.rb:289:in `block in register_callbacks'
from tty_time.rb:5:in `call'
from tty_time.rb:5:in `sleep'
from tty_time.rb:5:in `block in <main>'
from tty_time.rb:4:in `times'
from tty_time.rb:4:in `<main>'
I was poking around to find more behavior but ran out of time.
I started to use tty-progressbar to do a byte-related progress, but noticed really weird rates (not matching at all the overall mean rates I would calculate)
So far, I am assuming that when using the _rate tokens, one should get a rate calculation while passing actual units (not units per second) to ProgressBar's #advance and #current= methods.
From reading the code and the specs, it seems that Meter#sample expects to be given a rate (NOT an absolute advance). I say that since it's only averaging the sampled values instead of taking into account the sampling times.
But ProgressBar#advance is passing an absolute progress (in unit, not in unit/s).
I would propose a PR fixing this, but I'm not sure whether the "right" fix is to change Meter or ProgressBar (IMO, Meter could be changed to do more interesting things with rate calculations). If you're OK with it, I would change ProgressBar#sample to take the time and the absolute value (instead of progress) and update Meter to take into account the sample's time.
When using hide_cursor
, if the user presses Ctrl+C (or the progress bar is otherwise interrupted prematurely), then the cursor stays hidden.
One workaround I found, is to call bar.stop
in some ensure block, like so:
require 'tty-progressbar'
begin
bar = TTY::ProgressBar.new("downloading [:bar]", total: 30, hide_cursor: true)
30.times do
sleep(0.1)
bar.advance(1)
end
ensure
bar.stop
end
But this feels like it should be the library's responsibility, not the user's.
Run this, and press Ctrl+C before it finishes.
require 'tty-progressbar'
bar = TTY::ProgressBar.new("downloading [:bar]", total: 30, hide_cursor: true)
30.times do
sleep(0.1)
bar.advance(1)
end
The cursor stays hidden after termination.
The cursor should revert to its visible state after termination.
Perhaps something along these lines can work?
Change this:
tty-progressbar/lib/tty/progressbar.rb
Lines 272 to 276 in a662108
to this:
if hide_cursor && @last_render_width == 0 && !(@current >= total)
write(TTY::Cursor.hide)
+ at_exit { stop }
end
There is probably a better candidate than at_exit
, but this is the simplest idea I could come up with.
Let's say I have a bunch of things to compute. If a computation fails, I'd like to show its result in the associated progressbar. For example:
files = ['file1', 'file2']
bar = TTY::ProgressBar.new("Downloading: [:bar]", total: files.size)
files.each do |f|
result = download_file(f)
result_token = result ? '.' : 'x'
bar.advance(1, result_token)
end
A possible output:
Downloading: [. ]
Downloading: [.x]
I can make a PR if you find the idea useful.
I see a few nice things like the bar_format
option that has not yet made its way to a release + I noticed the latest release is from over a year ago.
Would love to have a new version published soon.
Hi!
First of all: nice gem! Unfortunately i found an issue when i tried it out: I changed your TTY::ProgressBar::Multi example by adding a third sub-progressbar with a different total
than the other two:
require 'tty-progressbar'
bars = TTY::ProgressBar::Multi.new("main [:bar] :percent")
bar1 = bars.register("one [:bar] :percent", total: 15)
bar2 = bars.register("two [:bar] :percent", total: 15)
bar3 = bars.register("thr [:bar] :percent", total: 45)
bars.start
th1 = Thread.new { 15.times { sleep(0.1); bar1.advance } }
th2 = Thread.new { 15.times { sleep(0.1); bar2.advance } }
th3 = Thread.new { 45.times { sleep(0.1); bar3.advance } }
[th1, th2, th3].each { |t| t.join }
That consistently (unless by coincidence the scheduling gives me the same result every time) gives me the following output:
ruby progressbar.rb
┌ main [===========================================================================] 100%
├── thr [================ ] 38%
├── two [===============] 100%
└── one [===============] 100%
Hope this helps :)
Progress Bar sometimes can have Unicode characters, such as CJKs from a file name.
Consider computing unicode width instead of string length, if unicode-display_width
gem is loaded.
(Or use other equivalent strategies.)
Hey Piotr!
I just wanted to thank you for creating tty-progressbar! It really helped us in a complex database migration that we had at work recently, it was so incredibly convenient to have all of these features available:
frequency
optioninterval
optionJust wanted to let you know that it worked great for us, and thank you for all your awesome work! ❤️
This seems super weird, but when I use progress.advance(1)
, I get a bunch of syscalls:
215.06 connection/s [======================================================================================================================================== ] 986/1000 ( 0s/ 4s)openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-1.24.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/console-1.8.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/nio4r-2.5.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/nio4r-2.5.2/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/timers-4.3.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-io-1.27.3/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-pool-0.2.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http1-0.10.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-http-0.50.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http-0.13.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http2-0.10.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-hpack-1.4.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-websocket-0.7.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/mapping-1.1.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/samovar-2.1.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/strings-ansi-0.1.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-progressbar-0.17.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-cursor-0.7.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-screen-0.7.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/unicode-display_width-1.6.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/2.7.0/x86_64-linux/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/2.7.0/x86_64-linux/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = 16
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 16
openat(AT_FDCWD, "/usr/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
214.64 connection/s [======================================================================================================================================== ] 987/1000 ( 0s/ 4s)openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-1.24.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/console-1.8.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/nio4r-2.5.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/nio4r-2.5.2/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/timers-4.3.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-io-1.27.3/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-pool-0.2.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http1-0.10.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-http-0.50.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http-0.13.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http2-0.10.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-hpack-1.4.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-websocket-0.7.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/mapping-1.1.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/samovar-2.1.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/strings-ansi-0.1.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-progressbar-0.17.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-cursor-0.7.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-screen-0.7.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/unicode-display_width-1.6.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/2.7.0/x86_64-linux/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/2.7.0/x86_64-linux/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = 16
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 16
openat(AT_FDCWD, "/usr/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
214.74 connection/s [======================================================================================================================================== ] 988/1000 ( 0s/ 4s)openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-1.24.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/console-1.8.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/nio4r-2.5.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/nio4r-2.5.2/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/timers-4.3.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-io-1.27.3/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-pool-0.2.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http1-0.10.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-http-0.50.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http-0.13.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http2-0.10.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-hpack-1.4.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-websocket-0.7.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/mapping-1.1.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/samovar-2.1.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/strings-ansi-0.1.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-progressbar-0.17.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-cursor-0.7.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-screen-0.7.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/unicode-display_width-1.6.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/2.7.0/x86_64-linux/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/2.7.0/x86_64-linux/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = 16
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 16
openat(AT_FDCWD, "/usr/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
214.69 connection/s [======================================================================================================================================== ] 989/1000 ( 0s/ 4s)openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-1.24.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/console-1.8.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/nio4r-2.5.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/nio4r-2.5.2/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/timers-4.3.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-io-1.27.3/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-pool-0.2.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http1-0.10.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-http-0.50.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http-0.13.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http2-0.10.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-hpack-1.4.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-websocket-0.7.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/mapping-1.1.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/samovar-2.1.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/strings-ansi-0.1.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-progressbar-0.17.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-cursor-0.7.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-screen-0.7.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/unicode-display_width-1.6.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/2.7.0/x86_64-linux/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/2.7.0/x86_64-linux/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = 16
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 16
openat(AT_FDCWD, "/usr/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
214.71 connection/s [========================================================================================================================================= ] 990/1000 ( 0s/ 4s)openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-1.24.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/console-1.8.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/nio4r-2.5.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/nio4r-2.5.2/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/timers-4.3.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-io-1.27.3/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-pool-0.2.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http1-0.10.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-http-0.50.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http-0.13.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http2-0.10.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-hpack-1.4.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-websocket-0.7.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/mapping-1.1.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/samovar-2.1.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/strings-ansi-0.1.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-progressbar-0.17.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-cursor-0.7.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-screen-0.7.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/unicode-display_width-1.6.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/2.7.0/x86_64-linux/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/2.7.0/x86_64-linux/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = 16
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 16
openat(AT_FDCWD, "/usr/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
214.61 connection/s [========================================================================================================================================= ] 991/1000 ( 0s/ 4s)openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-1.24.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/console-1.8.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/nio4r-2.5.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/nio4r-2.5.2/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/timers-4.3.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-io-1.27.3/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-pool-0.2.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http1-0.10.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-http-0.50.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http-0.13.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http2-0.10.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-hpack-1.4.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-websocket-0.7.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/mapping-1.1.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/samovar-2.1.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/strings-ansi-0.1.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-progressbar-0.17.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-cursor-0.7.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-screen-0.7.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/unicode-display_width-1.6.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/2.7.0/x86_64-linux/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/2.7.0/x86_64-linux/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = 16
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 16
openat(AT_FDCWD, "/usr/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
214.54 connection/s [========================================================================================================================================= ] 992/1000 ( 0s/ 4s)openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-1.24.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/console-1.8.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/nio4r-2.5.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/nio4r-2.5.2/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/timers-4.3.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-io-1.27.3/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-pool-0.2.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http1-0.10.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/async-http-0.50.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http-0.13.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-http2-0.10.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-hpack-1.4.2/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/protocol-websocket-0.7.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/mapping-1.1.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/samovar-2.1.4/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/strings-ansi-0.1.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-progressbar-0.17.0/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-cursor-0.7.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tty-screen-0.7.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/unicode-display_width-1.6.1/lib/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/2.7.0/x86_64-linux/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/site_ruby/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/2.7.0/x86_64-linux/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/vendor_ruby/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/ruby/2.7.0/fiddle.rb", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = 16
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/samuel/.rbenv/versions/2.7.0/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 16
openat(AT_FDCWD, "/usr/lib/kernel32", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
Do you have any require
statement embedded in code at some point? Removing the progress bar = no more syscalls of this nature.
In certain situations, we might not know total
in advance but we might still want to display a progress bar that shows the current count and elapsed count.
I was going to create an issue and start working on PR for this but then I noticed that there's an option called no_width
that addresses this already. Is there a reason it's not in the README? I could take a stab at documenting it. I also noticed that some of the formatters rely on having total
available to them.
can support add alignment column before the bar show?
as the following picture:
https://unix.stackexchange.com/questions/396223/bash-shell-script-output-alignment
Hi! 👋 Firstly, THANK YOU FOR THESE AMAZING GEMS! The TTY suite is exceptional.
When using TTY::ProgressBar::Multi
, logging with each registered bar results in corrupted output.
multi_bar = TTY::ProgressBar::Multi.new("Example [:bar] :percent", total: examples.count)
bars = [
multi_bar.register("Thread 1 [:bar] :percent", total: examples.count / 4),
multi_bar.register("Thread 2 [:bar] :percent", total: examples.count / 4),
multi_bar.register("Thread 3 [:bar] :percent", total: examples.count / 4),
multi_bar.register("Thread 4 [:bar] :percent", total: examples.count / 4)
]
Parallel.each(examples) do
bars[Parallel.worker_number].log "Something"
end
The previous logs are overwritten:
├── Thread 6 [= ] 50%[email protected]' (1912) updated
├── Thread 7 [= ] 50%[email protected]' (1911) updated
├── Thread 4 [= ] 50%[email protected]' (1913) updated
├── Thread 5 [= ] 50%super.com' (1915) updated
├── Thread 0 [= ] 50%[email protected]' (1608) updated
├── Thread 3 [= ] 50%[email protected]' (1874) updateded
Logging is printed above the multibar
This is a very useful gem. Have you considered adding the facility to provide a 'time left' indicator?
It should be possible to track the rate of progress of the bar, test if it is approximately linear, and if so, provide on ongoing indicator of the actual time left? You could also try to fit models other than linear.
Although it may take some time for me to get around to it, I would be prepared to prototype such a feature.
If the width option is specified for a child bar and this option is smaller than the total option of this child bar, the main bar breaks in two lines.
For example run this code:
#!/usr/bin/env ruby
require 'tty-progressbar'
bars = TTY::ProgressBar::Multi.new("main [:bar] :percent")
bar1 = bars.register "foo [:bar] :percent", total: 50, width: 20
bar2 = bars.register "bar [:bar] :percent", total: 200, width: 20
bar3 = bars.register "baz [:bar] :percent", total: 100, width: 20
th1 = Thread.new { 50.times { sleep(0.05); bar1.advance } }
th2 = Thread.new { 200.times { sleep(0.05); bar2.advance } }
th3 = Thread.new { 100.times { sleep(0.02); bar3.advance } }
[th1, th2, th3].each(&:join)
There is a workaround:
#!/usr/bin/env ruby
require 'tty-progressbar'
module TTY
class ProgressBar
class Multi
def register(format, options = {})
observable = options.delete(:observable) { true }
bar = TTY::ProgressBar.new(format, @options.merge(options))
synchronize do
bar.attach_to(self)
@bars << bar
observe(bar) if observable
if @top_bar
width = total
width = options[:width] if options[:width]
@top_bar.update(total: total, width: width)
end
end
bar
end
end
end
end
bars = TTY::ProgressBar::Multi.new("main [:bar] :percent")
bar1 = bars.register "foo [:bar] :percent", total: 50, width: 20
bar2 = bars.register "bar [:bar] :percent", total: 200, width: 20
bar3 = bars.register "baz [:bar] :percent", total: 100, width: 20
th1 = Thread.new { 50.times { sleep(0.05); bar1.advance } }
th2 = Thread.new { 200.times { sleep(0.05); bar2.advance } }
th3 = Thread.new { 100.times { sleep(0.02); bar3.advance } }
[th1, th2, th3].each(&:join)
Tested on ubuntu 16.04 ruby version 2.3.1p112
Right now the start_at
time on the ProgressBar
is set once the counter advances from zero. It would be nice to have more control over this as the eta and elapsed time could be wrong (the time shouldn't necessarily start when the progress advances past).
p = TTY::ProgressBar.new("[:bar]", total: 100)
p.start # Draws the bar @0% progress and initializes the start_at property
p.advance(50) # Draws the bar @50% progress
p.reset # Resets the progress bar @0% progress
p.advance(50) # Draws the bar @50% progress
p.finish # Draws the bar @100% progress and finishes it
Multi progress bar's top_bar
does not update drawing current / total values properly with registering new child bars.
require 'bundler/inline'
gemfile true do
source 'http://rubygems.org'
gem 'tty-progressbar'
end
class FetchPackages
def run
@multibar = TTY::ProgressBar::Multi.new('Fetching packages (:current/:total)')
validate_local_cache
fetch
end
def validate_local_cache
bar = @multibar.register('Validating local cache', total: 1)
sleep 2
bar.advance
end
def fetch
bar = @multibar.register('Fetching :percent (:current/:total)', total: 20)
20.times do
sleep 0.5
bar.advance
end
end
end
FetchPackages.new.run
┌ Fetching packages (1/1)
└── Validating local cache
└── Fetching 100% (20/20)
┌ Fetching packages (21/21)
├── Validating local cache
└── Fetching 100% (20/20)
ruby:2.7.0
When I interrupt my script with CTRL+C, it seems that tty-progressbar goes through #require which is forbidden in trap context
Backtrace
/home/doudou/.rbenv/versions/2.3.1/lib/ruby/2.3.0/monitor.rb:187:in `lock': can't be called from trap context (ThreadError)
from /home/doudou/.rbenv/versions/2.3.1/lib/ruby/2.3.0/monitor.rb:187:in `mon_enter'
from /home/doudou/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from /home/doudou/.autoproj/gems/ruby/2.3.0/gems/tty-screen-0.4.3/lib/tty/screen/size.rb:49:in `try_io_console'
from /home/doudou/.autoproj/gems/ruby/2.3.0/gems/tty-screen-0.4.3/lib/tty/screen/size.rb:37:in `from_io_console'
from /home/doudou/.autoproj/gems/ruby/2.3.0/gems/tty-screen-0.4.3/lib/tty/screen/size.rb:21:in `size'
from /home/doudou/.autoproj/gems/ruby/2.3.0/gems/tty-screen-0.4.3/lib/tty/screen.rb:46:in `size'
from /home/doudou/.autoproj/gems/ruby/2.3.0/gems/tty-screen-0.4.3/lib/tty/screen.rb:28:in `size'
from /home/doudou/.autoproj/gems/ruby/2.3.0/gems/tty-screen-0.4.3/lib/tty/screen.rb:33:in `width'
from /home/doudou/.autoproj/gems/ruby/2.3.0/gems/tty-progressbar-0.7.0/lib/tty/progressbar.rb:266:in `max_columns'
from /home/doudou/.autoproj/gems/ruby/2.3.0/gems/tty-progressbar-0.7.0/lib/tty/progressbar.rb:289:in `block in register_callbacks'
from /home/doudou/dev/flat_fish/tools/pocolog/lib/pocolog/file.rb:739:in `read'
from /home/doudou/dev/flat_fish/tools/pocolog/lib/pocolog/file.rb:739:in `data_header'
from /home/doudou/dev/flat_fish/tools/pocolog/lib/pocolog/data_reader.rb:307:in `advance'
from /home/doudou/dev/flat_fish/tools/log_tools/lib/log_tools/file_upgrader.rb:62:in `block in upgrade'
from /home/doudou/dev/flat_fish/tools/log_tools/lib/log_tools/file_upgrader.rb:28:in `each'
from /home/doudou/dev/flat_fish/tools/log_tools/lib/log_tools/file_upgrader.rb:28:in `upgrade'
from /home/doudou/dev/flat_fish/tools/log_tools/lib/log_tools/cli.rb:39:in `block in upgrade'
from /home/doudou/dev/flat_fish/tools/log_tools/lib/log_tools/cli.rb:30:in `each'
from /home/doudou/dev/flat_fish/tools/log_tools/lib/log_tools/cli.rb:30:in `upgrade'
from /home/doudou/.autoproj/gems/ruby/2.3.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /home/doudou/.autoproj/gems/ruby/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /home/doudou/.autoproj/gems/ruby/2.3.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /home/doudou/.autoproj/gems/ruby/2.3.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /home/doudou/dev/flat_fish/tools/log_tools/bin/rock-log:3:in `<main>'
I would like to ask if it's possible with tty-progressbar
to display multiple progress bars at the same time from multiple processes. For example, something like :
downloading file1 [======================= ]
downloading file2 [====== ]
downloading file3 [============= ]
downloading file4 [========== ]
Thanks
A brief description of the issue/feature.
Hi, I tried using tty-progressbar in a project of mine and mix it with another project using the latest versions of tty-markdown and tty-prompt, and a gem conflict occurred that forced me to downgrade them to accommodate strings-ansi '~> 0.1.0' (from 0.2)
I just saw you have changed the dependency to `~> 0.2', which would resolve my issue.
My only question is when will you be making the next release? And, if not soon, would you be able to make a quick patch release in the meantime with only that dependency change?
Is a TTY:Progressbar threadsafe, can I share an instance between multiple threads, all of which call advance
on it?
Upon multibar registration, the parent's total is recalculated. This raises:
NoMethodError: undefined method `+' for nil:NilClass
I'll submit a PR to fix.
require 'tty/progressbar/multi'
main = TTY::ProgressBar::Multi.new("All the things: :current")
bars = Hash.new { |hash, key| hash[key] = main.register("#{key}: :current") }
5.times do |i|
100.times do
sleep 0.01
bars["Thing #{i}"].advance
end
end
/Users/ttilberg/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/tty-progressbar-0.18.1/lib/tty/progressbar/multi.rb:145:in `each': undefined method `+' for nil:NilClass (NoMethodError)
▶ ruby multi.rb
┌ Total: 500
└── Thing 0: 100
└── Thing 1: 100
└── Thing 2: 100
└── Thing 3: 100
└── Thing 4: 100
MacOS 10.15.7
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
0.18.1
Sometimes while a progress bar is in progress, you want to output some status or log information.
ruby-progressbar has a log
feature that will let you print some lines to the screen , without completely messing up the painting of the still-in-progress progress bar. https://github.com/jfelchner/ruby-progressbar/wiki/Logging
tty-progressbar appears not to have this feature? It's a crucial one.
Came up on on a /r/ruby question. https://www.reddit.com/r/ruby/comments/9nhos9/suggest_a_pretty_command_line_program_toolkit/
These would be very useful for seeing the speed (as many people who use this library would likely use it for displaying download progress) e.g. "1.32MB/s"
.
If #6 is implemented, adding the :average_speed token would be trivial.
After upgrading from 0.17.0 to 0.18.0, I started receiving NaN (FloatDomainError)
exceptions.
I tracked it to the :eta
marker.
Save this self-contained ruby file and run it.
require 'bundler/inline'
gemfile do
source "https://rubygems.org"
gem 'tty-progressbar', '0.18.0' # BROKEN
# gem 'tty-progressbar', '0.17.0' # OK
end
def progress_bar(text, count)
# BROKEN
TTY::ProgressBar.new "#{text} :bar ETA :eta", total: count
# OK
# TTY::ProgressBar.new "#{text} :bar", total: count
end
total = 50
bar = progress_bar "downloading", total
total.times do |i|
bar.log "Working on #{i}/#{total}"
sleep 0.1
bar.advance
end
Exception raised:
/store/gems/ruby-3.0.0/gems/tty-progressbar-0.18.0/lib/tty/progressbar/converter.rb:18:in `floor': NaN (FloatDomainError)
from /store/gems/ruby-3.0.0/gems/tty-progressbar-0.18.0/lib/tty/progressbar/converter.rb:18:in `to_time'
from /store/gems/ruby-3.0.0/gems/tty-progressbar-0.18.0/lib/tty/progressbar/formatter/estimated.rb:28:in `call'
from /store/gems/ruby-3.0.0/gems/tty-progressbar-0.18.0/lib/tty/progressbar/pipeline.rb:44:in `block in decorate'
from /store/gems/ruby-3.0.0/gems/tty-progressbar-0.18.0/lib/tty/progressbar/pipeline.rb:42:in `each'
from /store/gems/ruby-3.0.0/gems/tty-progressbar-0.18.0/lib/tty/progressbar/pipeline.rb:42:in `inject'
from /store/gems/ruby-3.0.0/gems/tty-progressbar-0.18.0/lib/tty/progressbar/pipeline.rb:42:in `decorate'
from /usr/share/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/forwardable.rb:238:in `decorate'
from /store/gems/ruby-3.0.0/gems/tty-progressbar-0.18.0/lib/tty/progressbar.rb:345:in `render'
from /store/gems/ruby-3.0.0/gems/tty-progressbar-0.18.0/lib/tty/progressbar.rb:555:in `log'
from test.rb:20:in `block in <main>'
from test.rb:19:in `times'
from test.rb:19:in `<main>'
It is expected to work as version 0.17.0, not crash and respect the :eta
marker.
So I was hoping to use this gem to show the current status of a buffer in progress bar form. I know the maximum size, so this isn't indeterminate.
My problem? If the buffer gets full, the bar finishes, and there's no way to stop it.
I thought of just adding one to total or something, but that would throw the percentage and bar progress off.
I was thinking an auto_finish: false
option, which is checked when currently the bar ends if current == total
.
Can you see any potential drawbacks?
Would need to handle cases where current is set to something > total
, but that wouldn't be hard.
If I using tty-progressbar CTRL+C
key combination not working, it doesn't stop application at all.
Steps to reproduce:
Expected results:
Application interrupt
Hi! Thanks for providing this gem. I wanted to let you know that c3e2221 causes problems when installing the tty gem, producing output like the following:
ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: tty requires tty-screen (~> 0.1.0); tty-progressbar requires tty-screen (~> 0.2.0); tty-table requires tty-screen (~> 0.1)
Is it possible to get them all in sync? I can also resolve this by updating my gem file to require a previous version of tty, but I wasn't sure if you'd seen this error.
If progressbar is finished and terminal size is changed:
tty-progressbar-0.8.1/lib/tty/progressbar.rb:188:in `resize'
tty-progressbar-0.8.1/lib/tty/progressbar.rb:309:in `block in register_signals'
First off, love the library, couldn't be much easier to use. I'm presenting a download progress bar and I'd like to show the current download progress in something like "1.1MB/3.4MB" and currently the :total token uses the total bytes. I think this might be a common enough use case to bake a new formatter into the library?
I'm not sure whether it aligns with the gem's purpose, but I think it would be quite nice to have a built-in function wrapping an enumerable with a progressbar, so instead of manually advancing a progressbar with every iteration:
bar = TTY::ProgressBar.new("downloading [:bar]", total: 30)
30.times do
sleep(0.1)
bar.advance(1)
end
one could just call something like:
with_bar(enumerable).map { |v| computation(v) }
An example of a simple with_bar implementation:
def with_bar(ary)
Enumerator.new do |y|
bar = TTY::ProgressBar.new('[:bar]', total: ary.size)
ary.each do |e|
bar.advance(1)
y << e
end
end
end
Perhaps with_bar should take another argument, so one could customize a progressbar.
What do you think?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.