Skip to content

Commit 0551a5d

Browse files
committed
Drop dependency on posix-spawn
This gem no longer build on the latest clang version: ``` posix-spawn.c:226:27: error: incompatible function pointer types passing 'int (VALUE, VALUE, posix_spawn_file_actions_t *)' (aka 'int (unsigned long, unsigned long, void **)') to parameter of type 'int (*)(VALUE, VALUE, VALUE)' (aka 'int (*)(unsigned long, unsigned long, unsigned long)') [-Wincompatible-function-pointer-types] rb_hash_foreach(options, posixspawn_file_actions_operations_iter, (VALUE)fops); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /opt/rubies/3.4-dev-03-19/include/ruby-3.4.0+0/ruby/internal/intern/hash.h:83:40: note: passing argument to parameter 'func' here void rb_hash_foreach(VALUE hash, int (*func)(VALUE key, VALUE val, VALUE arg), VALUE arg); ``` It's also unnecessary given Ruby's `Process.spawn` use `vfork(2)` so it's essentially the same as `posix-spawn`. The only difference is that Ruby fallback to using `fork(2)` when running as root, but that's not something that should be common. Other than that there is no perf gain to use `posix-spawn` gem.
1 parent 5499c37 commit 0551a5d

2 files changed

Lines changed: 1 addition & 4 deletions

File tree

binaryen.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@ Gem::Specification.new do |spec|
1515
spec.homepage = "https://github.com/Shopify/binaryen-rb"
1616
spec.platform = Gem::Platform::RUBY
1717
spec.extensions = ["extconf.rb"]
18-
spec.add_dependency("posix-spawn", "~> 0.3.15")
1918
end

lib/binaryen/command.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# frozen_string_literal: true
22

3-
require "posix/spawn"
43
require "timeout"
54
require "tempfile"
65

76
module Binaryen
87
class Command
9-
include POSIX::Spawn
108
DEFAULT_MAX_OUTPUT_SIZE = 256 * 1024 * 1024 * 1024 # 256 MiB
119
DEFAULT_TIMEOUT = 10
1210
DEFAULT_ARGS_FOR_COMMAND = {}.freeze
@@ -44,7 +42,7 @@ def spawn_command(*args, stderr: nil, stdin: nil)
4442

4543
File.open(File::NULL, "w") do |devnull|
4644
IO.pipe do |err_read, err_write|
47-
pid = POSIX::Spawn.pspawn(
45+
pid = Process.spawn(
4846
*args,
4947
"--output=#{tmpfile.path}",
5048
in_write.path,

0 commit comments

Comments
 (0)