HazAT / badge

Add a badge to your app icon
MIT License
966 stars 87 forks source link

stream closed in another thread (IOError) in mini_magick #112

Closed gtatgh closed 2 years ago

gtatgh commented 3 years ago

I installed imagemagick as stated in README in section "Common problems" on macOS 11.5.2 (20G95) and run badge. Unfortunately I got the following error message:

DEBUG [2021-08-26 12:51:45.71]: Verbose active... VERSION: 0.13.0
DEBUG [2021-08-26 12:51:45.71]: Parameters: {:dark=>true, :shield=>"xxx-orange", :alpha=>nil, :alpha_channel=>nil, :custom=>nil, :no_badge=>nil, :badge_gravity=>nil, :shield_parameters=>nil, :shield_io_timeout=>nil, :shield_geometry=>nil, :shield_gravity=>nil, :shield_scale=>nil, :shield_no_resize=>nil, :glob=>nil, :grayscale=>false}
INFO [2021-08-26 12:51:45.71]: Start adding badges...
DEBUG [2021-08-26 12:51:45.71]: Trying to load image from shields.io. Timeout: 10s
DEBUG [2021-08-26 12:51:45.71]: URL: https://img.shields.io/badge/xxx-orange.svg
#<Thread:0x00007f89db2bb5f8@/Users/user/.gem/gems/mini_magick-4.11.0/lib/mini_magick/shell.rb:45 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
    1: from /Users/user/.gem/gems/mini_magick-4.11.0/lib/mini_magick/shell.rb:45:in `block (2 levels) in execute_open3'
/Users/user/.gem/gems/mini_magick-4.11.0/lib/mini_magick/shell.rb:45:in `read': stream closed in another thread (IOError)
#<Thread:0x00007f89db2bb4b8@/Users/user/.gem/gems/mini_magick-4.11.0/lib/mini_magick/shell.rb:46 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
    1: from /Users/user/.gem/gems/mini_magick-4.11.0/lib/mini_magick/shell.rb:46:in `block (2 levels) in execute_open3'
/Users/user/.gem/gems/mini_magick-4.11.0/lib/mini_magick/shell.rb:46:in `read': stream closed in another thread (IOError)
^CERROR [2021-08-26 12:52:09.39]: Other error occured. Use --verbose for more info
DEBUG [2021-08-26 12:52:09.39]: 
INFO [2021-08-26 12:52:09.39]: Waiting for 10s and retry to load image from shields.io tries remaining: 10

So after searching old issues I found that GraphicsMagick can be used as an alternative. So I installed GraphicsMagick using the following command:

$ sudo port install GraphicsMagick 

The next time I ran badge, it was able to run it without error messages. On recommendation in stdout output I installed librsvg via the following command:

$ sudo port install librsvg

Unfortunately it came to the same error message as above.

It would be good to mention in README or in stdout that GraphicsMagick or another graphics library can be used as an alternative.

gtatgh commented 3 years ago

The optional dependency on librsvg is frustrating. I found out that ffmpeg also uses this library. Every time I want to build a new app version, I have to deactivate this library using sudo port deactivate librsvg. Is it possible to add an option if one really wants to use librsvg library?

HazAT commented 2 years ago

You can opt out using svg and use imagemagick instead with pngs No other alternative sorry