binaryen 1.1.6.8 → 1.1.6.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4217d4168d453c8e5316e9c66929d5e09057ec356dc6f80802c41521de6fd612
4
- data.tar.gz: 2cb4b068c0456d72dcc55cf0d945a5357df0d3ad8c82166fca8a57dcd2908ec4
3
+ metadata.gz: 7a03d6e05a577d6579506e64e603e11f9430bf4d4f19c4d3f5cf0e984ad78387
4
+ data.tar.gz: c2995a3d92c07731d5b54b832c0d838159aebd2770dc1b4e0155bcc09ef2e7a8
5
5
  SHA512:
6
- metadata.gz: 9e3fd947316b466a8d592014bc57b1c34148da5b3042e0630b2bc5f56e54c287ab4c6416e78c1ef392e88429cbbcba0c0c3549bdd8b99d7068972c1adeb0c698
7
- data.tar.gz: 2cdfe8e57ab692f16e911e7a819cb6cfecbf9b31027a04c8863eb919fd952cb6d92832d3884768cf05704507c7c408bcfb19eed3c47b90dfcbb6f1e7eaefc679
6
+ metadata.gz: 01cdacd58083894fd4356f23032b00c00a4f586ac4d141742a50471228d772623027178e2b93879d9d224b3dc98fcdeb5c90374700914a7021752acbdaa78720
7
+ data.tar.gz: cfddf72d19ad3922e7152ec150d1ce31a936b54f25e1638674be47d453dd808353110ec481749977bd54a78369b2db3c7331342af7ae918a9cbef447261ec3f9
@@ -7,11 +7,12 @@ require "tempfile"
7
7
  module Binaryen
8
8
  class Command
9
9
  include POSIX::Spawn
10
- DEFAULT_MAX_OUTPUT_SIZE = 256 * 1024 * 1024
10
+ DEFAULT_MAX_OUTPUT_SIZE = 256 * 1024 * 1024 * 1024 # 256 MiB
11
11
  DEFAULT_TIMEOUT = 10
12
12
  DEFAULT_ARGS_FOR_COMMAND = {
13
13
  "wasm-opt" => ["--output=-"],
14
14
  }.freeze
15
+ BUFSIZE = 32 * 1024
15
16
 
16
17
  def initialize(cmd, timeout: DEFAULT_TIMEOUT, max_output_size: DEFAULT_MAX_OUTPUT_SIZE, ignore_missing: false)
17
18
  @cmd = command_path(cmd, ignore_missing) || raise(ArgumentError, "command not found: #{cmd}")
@@ -47,11 +48,9 @@ module Binaryen
47
48
 
48
49
  def spawn_command(*args, stderr: nil)
49
50
  out = "".b
50
- data_buffer = "".b
51
51
  start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
52
52
  pid, stdin, stdout, stderr_stream = popen4(*args)
53
53
  stdin.close
54
- @pid = pid
55
54
  readers = [stdout, stderr_stream]
56
55
 
57
56
  while readers.any?
@@ -61,33 +60,31 @@ module Binaryen
61
60
  raise Timeout::Error, "command timed out after #{@timeout} seconds" if ready.nil?
62
61
 
63
62
  ready[0].each do |io|
64
- max_amount_to_read = @max_output_size - out.bytesize + 1
65
- data = io.read_nonblock(max_amount_to_read, data_buffer, exception: false)
63
+ data = io.read_nonblock(BUFSIZE, exception: false)
66
64
 
67
65
  if data == :wait_readable
68
66
  # If the IO object is not ready for reading, read_nonblock returns :wait_readable.
69
67
  # This isn't an error, but a notification.
70
- next
71
68
  elsif data.nil?
72
69
  # At EOF, read_nonblock returns nil instead of raising EOFError.
73
70
  readers.delete(io)
71
+ io.close
74
72
  elsif io == stdout
75
- out << data_buffer
73
+ out << data
76
74
  elsif io == stderr_stream && stderr
77
- stderr << data_buffer
75
+ stderr << data
78
76
  end
79
- rescue Errno::EPIPE, Errno::EINTR
80
- # Handle EPIPE and EINTR errors
81
- readers.delete(io)
77
+ rescue Errno::EINTR
78
+ # This means that the read was interrupted by a signal, which is not an error. So we just retry.
82
79
  end
83
80
 
84
81
  if out.bytesize > @max_output_size
85
- Process.kill("TERM", @pid)
82
+ Process.kill("TERM", pid)
86
83
  raise Binaryen::MaximumOutputExceeded, "maximum output size exceeded (#{@max_output_size} bytes)"
87
84
  end
88
85
 
89
86
  if remaining_time < 0
90
- Process.kill("TERM", @pid)
87
+ Process.kill("TERM", pid)
91
88
  raise Timeout::Error, "command timed out after #{@timeout} seconds"
92
89
  end
93
90
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Binaryen
4
- VERSION = "1.1.6.8"
4
+ VERSION = "1.1.6.10"
5
5
  BINARYEN_VERSION = "version_116"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binaryen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6.8
4
+ version: 1.1.6.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-19 00:00:00.000000000 Z
11
+ date: 2024-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: posix-spawn
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  - !ruby/object:Gem::Version
107
107
  version: '0'
108
108
  requirements: []
109
- rubygems_version: 3.4.22
109
+ rubygems_version: 3.5.4
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: Vendors binaryen libraries, headers, and executables for use in Ruby