mini_magick 4.9.0 → 4.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mini_magick might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/mini_magick/image/info.rb +2 -2
- data/lib/mini_magick/shell.rb +21 -27
- data/lib/mini_magick/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd1b90888eb75abf0899889732c4e4321813141e80dea7f9fa5cce53605f9c26
|
4
|
+
data.tar.gz: 325191562a968ccbabd99ab4946d78f95caebbbb510992f0fb1bb65c770b364d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
data/lib/mini_magick/shell.rb
CHANGED
@@ -38,9 +38,27 @@ module MiniMagick
|
|
38
38
|
def execute_open3(command, options = {})
|
39
39
|
require "open3"
|
40
40
|
|
41
|
-
|
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
|
-
|
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)
|
data/lib/mini_magick/version.rb
CHANGED