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 +4 -4
- data/lib/binaryen/command.rb +10 -13
- data/lib/binaryen/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a03d6e05a577d6579506e64e603e11f9430bf4d4f19c4d3f5cf0e984ad78387
|
4
|
+
data.tar.gz: c2995a3d92c07731d5b54b832c0d838159aebd2770dc1b4e0155bcc09ef2e7a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01cdacd58083894fd4356f23032b00c00a4f586ac4d141742a50471228d772623027178e2b93879d9d224b3dc98fcdeb5c90374700914a7021752acbdaa78720
|
7
|
+
data.tar.gz: cfddf72d19ad3922e7152ec150d1ce31a936b54f25e1638674be47d453dd808353110ec481749977bd54a78369b2db3c7331342af7ae918a9cbef447261ec3f9
|
data/lib/binaryen/command.rb
CHANGED
@@ -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
|
-
|
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 <<
|
73
|
+
out << data
|
76
74
|
elsif io == stderr_stream && stderr
|
77
|
-
stderr <<
|
75
|
+
stderr << data
|
78
76
|
end
|
79
|
-
rescue Errno::
|
80
|
-
#
|
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",
|
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",
|
87
|
+
Process.kill("TERM", pid)
|
91
88
|
raise Timeout::Error, "command timed out after #{@timeout} seconds"
|
92
89
|
end
|
93
90
|
end
|
data/lib/binaryen/version.rb
CHANGED
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.
|
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:
|
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
|
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
|