mini_magick 4.9.0 → 4.9.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of mini_magick might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec4d1852a0e65227776a89740f0ba57fe4925e41806387fc194492f825c9f5ea
4
- data.tar.gz: 5263d3061216db6852a0b89d9b2ab0c32f05fcd9b685bf1aca125d41d52c714a
3
+ metadata.gz: bd1b90888eb75abf0899889732c4e4321813141e80dea7f9fa5cce53605f9c26
4
+ data.tar.gz: 325191562a968ccbabd99ab4946d78f95caebbbb510992f0fb1bb65c770b364d
5
5
  SHA512:
6
- metadata.gz: 12b052fb0879fe8e3d59d6f626ff5690f26795bf8a23b7990ba86fc74382c103f8582760dbae26d8910c7e6877d853fbea13ebf3c93e524f93901cb57635935c
7
- data.tar.gz: 5f5fda33afe5326356f3d9f2930160559b5bbe372528313c4ecebfad91a1de86edb9f2503426c0cff96035430a7a6c83a24b79174b520ecd55c31ce880eb49f1
6
+ metadata.gz: 1964d16e84e1c032564068345b42312e64915bb71fd6560c17a73a33bcbccae3fb1453ecc79e600df0e55183031a6673a2ae2ad454941c76f97c7939f50b8b16
7
+ data.tar.gz: f2846d504c4c95e29a17bfb880a40ba6685e4a5f0511997560c5a46d967b743ec6403343300ca8344ccd9a470fd3a0085d2c14c075c7efaccae1a4825c68444f
@@ -91,7 +91,7 @@ module MiniMagick
91
91
  line = line.chomp("\n")
92
92
 
93
93
  case MiniMagick.cli
94
- when :imagemagick
94
+ when :imagemagick, :imagemagick7
95
95
  if match = line.match(/^exif:/)
96
96
  key, value = match.post_match.split("=", 2)
97
97
  value = decode_comma_separated_ascii_characters(value) if ASCII_ENCODED_EXIF_KEYS.include?(key)
@@ -120,7 +120,7 @@ module MiniMagick
120
120
  end
121
121
 
122
122
  def details
123
- warn "[MiniMagick] MiniMagick::Image#details has been deprecated, as it was causing too many parsing errors. You should use MiniMagick::Image#data instead, which differs in a way that the keys are in camelcase." if MiniMagick.imagemagick?
123
+ warn "[MiniMagick] MiniMagick::Image#details has been deprecated, as it was causing too many parsing errors. You should use MiniMagick::Image#data instead, which differs in a way that the keys are in camelcase." if MiniMagick.imagemagick? || MiniMagick.imagemagick7?
124
124
 
125
125
  @info["details"] ||= (
126
126
  details_string = identify(&:verbose)
@@ -38,9 +38,27 @@ module MiniMagick
38
38
  def execute_open3(command, options = {})
39
39
  require "open3"
40
40
 
41
- in_w, out_r, err_r, subprocess_thread = Open3.popen3(*command)
41
+ # We would ideally use Open3.capture3, but it wouldn't allow us to
42
+ # terminate the command after timing out.
43
+ Open3.popen3(*command) do |in_w, out_r, err_r, thread|
44
+ [in_w, out_r, err_r].each(&:binmode)
45
+ stdout_reader = Thread.new { out_r.read }
46
+ stderr_reader = Thread.new { err_r.read }
47
+ begin
48
+ in_w.write options[:stdin].to_s
49
+ rescue Errno::EPIPE
50
+ end
51
+ in_w.close
52
+
53
+ begin
54
+ Timeout.timeout(MiniMagick.timeout, nil, "MiniMagick command timed out: #{command}") { thread.join }
55
+ ensure
56
+ Process.kill("TERM", thread.pid) rescue nil
57
+ Process.waitpid(thread.pid) rescue nil
58
+ end
42
59
 
43
- capture_command(in_w, out_r, err_r, subprocess_thread, options)
60
+ [stdout_reader.value, stderr_reader.value, thread.value]
61
+ end
44
62
  end
45
63
 
46
64
  def execute_posix_spawn(command, options = {})
@@ -48,31 +66,7 @@ module MiniMagick
48
66
  child = POSIX::Spawn::Child.new(*command, input: options[:stdin].to_s, timeout: MiniMagick.timeout)
49
67
  [child.out, child.err, child.status]
50
68
  rescue POSIX::Spawn::TimeoutExceeded
51
- raise Timeout::Error
52
- end
53
-
54
- def capture_command(in_w, out_r, err_r, subprocess_thread, options)
55
- [in_w, out_r, err_r].each(&:binmode)
56
- stdout_reader = Thread.new { out_r.read }
57
- stderr_reader = Thread.new { err_r.read }
58
- begin
59
- in_w.write options[:stdin].to_s
60
- rescue Errno::EPIPE
61
- end
62
- in_w.close
63
-
64
- Timeout.timeout(MiniMagick.timeout) { subprocess_thread.join }
65
-
66
- [stdout_reader.value, stderr_reader.value, subprocess_thread.value]
67
- rescue Timeout::Error => error
68
- begin
69
- Process.kill("TERM", subprocess_thread.pid)
70
- rescue Errno::ESRCH
71
- # ignore if the PID doesn't exist
72
- end
73
- raise error
74
- ensure
75
- [out_r, err_r].each(&:close)
69
+ raise Timeout::Error, "MiniMagick command timed out: #{command}"
76
70
  end
77
71
 
78
72
  def log(command, &block)
@@ -9,7 +9,7 @@ module MiniMagick
9
9
  module VERSION
10
10
  MAJOR = 4
11
11
  MINOR = 9
12
- TINY = 0
12
+ TINY = 1
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_magick
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.0
4
+ version: 4.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Johnson