binaryen 1.1.6.9 → 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: 18c535d2045e224d5ba46b3117e7eced2ff502b0cb338c6e7307113f011cb5fa
4
- data.tar.gz: 8d1a5f09b94e86221e142d0773c8b23ea0a1987275a322a175daf84db2b2e01b
3
+ metadata.gz: 7a03d6e05a577d6579506e64e603e11f9430bf4d4f19c4d3f5cf0e984ad78387
4
+ data.tar.gz: c2995a3d92c07731d5b54b832c0d838159aebd2770dc1b4e0155bcc09ef2e7a8
5
5
  SHA512:
6
- metadata.gz: dea3bf6b7f13d19fc83dc18632092306650ae3b077f2221fa62c0f35beaee50a4acf54ff50f114049da1bdf4b4485076f19e3039e9ec714b158468fb07286850
7
- data.tar.gz: ac18a83b7221afaa90c2643ccad41af25f1be1bac141011afb056cc16a824e98c7c75832fe03b7f18b703184479faff1fe9bff127eb255cec321d50904a2e35e
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)
74
71
  io.close
75
72
  elsif io == stdout
76
- out << data_buffer
73
+ out << data
77
74
  elsif io == stderr_stream && stderr
78
- stderr << data_buffer
75
+ stderr << data
79
76
  end
80
77
  rescue Errno::EINTR
81
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.9"
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.9
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: 2024-01-08 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