mini_magick 5.3.1 → 5.3.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: edcf3d52dfa447f650be4854b37f3352979bb33c52726fe0b48174b9f66d8259
4
- data.tar.gz: 979b3307e4fc554f29d2f0293e1267d968fff48a9f6948c750efae4d5dfd813e
3
+ metadata.gz: 4e0a993e69c42a76477e2002d0e2aeaa51feefe85e39f1fd41bacae32daa98a1
4
+ data.tar.gz: 30b93efd2b00c30f3f959ba24ac2995d6d57f5e72f40a025f44cb9b92492d91f
5
5
  SHA512:
6
- metadata.gz: 3d53b6c00fafe8db9142358a3d56daa971e305a3a8a2161a19b8f7893fbaffd6c37bc06de1f2e5f9bd026ae8dd936102af274c118ea70f7107b0645b4fac9e27
7
- data.tar.gz: 4a94a35509be48ae56ba3113778a49ca592569bc0ee711856c50d89f3b4cf277ccf207ff616b20b3e56c305fabb88a2534542ff79937fdf8e2e77e3caf541f01
6
+ metadata.gz: 1cff1e1f6dabb0bec2bc3a346212f0add2d2fd83c6e25c7d48f1a9c9f6ce0ab042cce699127f64152054e7dbd63efb038c8dec4c1a5d3508b1af25e59672dc50
7
+ data.tar.gz: f09c780d5e5eae7fb276ab137495ec89aba893ba49299ade03a3d6084075f2563f970c76543696790f3e500f9796b79a43c5b8cd85b2fc6dcf11fcda13adf184
@@ -31,7 +31,33 @@ module MiniMagick
31
31
  env["MAGICK_TIME_LIMIT"] = timeout.to_s if timeout
32
32
 
33
33
  stdout, stderr, status = log(command.join(" ")) do
34
- Open3.capture3(env, *command, stdin_data: stdin, unsetenv_others: MiniMagick.restricted_env)
34
+ # We would ideally use Open3.capture3, but it doesn't allow us to
35
+ # terminate the command after timing out. We can't rely solely on
36
+ # ImageMagick's own $MAGICK_TIME_LIMIT for this, because it's only
37
+ # checked periodically inside ImageMagick's processing loops, so it
38
+ # can fire too late (or not at all) depending on the operation.
39
+ Open3.popen3(env, *command, unsetenv_others: MiniMagick.restricted_env) do |stdin_io, stdout_io, stderr_io, wait_thread|
40
+ stdin_io.binmode
41
+ stdout_io.binmode
42
+ stderr_io.binmode
43
+
44
+ stdout_reader = Thread.new { stdout_io.read }
45
+ stderr_reader = Thread.new { stderr_io.read }
46
+
47
+ begin
48
+ stdin_io.write(stdin)
49
+ rescue Errno::EPIPE
50
+ end
51
+ stdin_io.close
52
+
53
+ if timeout && !wait_thread.join(timeout)
54
+ Process.kill("TERM", wait_thread.pid) rescue nil
55
+ wait_thread.join
56
+ fail MiniMagick::TimeoutError, "`#{command.join(" ")}` has timed out"
57
+ end
58
+
59
+ [stdout_reader.value, stderr_reader.value, wait_thread.value]
60
+ end
35
61
  end
36
62
 
37
63
  [stdout, stderr, status&.exitstatus]
@@ -27,7 +27,7 @@ module MiniMagick
27
27
  # instance of the tool, if block is given, returns the output of the
28
28
  # command.
29
29
  #
30
- def self.new(name, **options)
30
+ def self.new(*args, **options)
31
31
  instance = super
32
32
 
33
33
  if block_given?
@@ -9,7 +9,7 @@ module MiniMagick
9
9
  module VERSION
10
10
  MAJOR = 5
11
11
  MINOR = 3
12
- TINY = 1
12
+ TINY = 2
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: 5.3.1
4
+ version: 5.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Johnson
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  requirements:
101
101
  - You must have ImageMagick installed
102
- rubygems_version: 3.6.7
102
+ rubygems_version: 4.0.13
103
103
  specification_version: 4
104
104
  summary: Manipulate images with minimal use of memory via ImageMagick
105
105
  test_files: []