Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix argument delegation (Ruby 3x) #185

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/childprocess.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ def new(*args)
case os
when :macosx, :linux, :solaris, :bsd, :cygwin, :aix
if posix_spawn?
Unix::PosixSpawnProcess.new(args)
Unix::PosixSpawnProcess.new(*args)
elsif jruby?
JRuby::Process.new(args)
JRuby::Process.new(*args)
else
Unix::ForkExecProcess.new(args)
Unix::ForkExecProcess.new(*args)
end
when :windows
Windows::Process.new(args)
Windows::Process.new(*args)
else
raise Error, "unsupported platform #{platform_name.inspect}"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/childprocess/abstract_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AbstractProcess
# @see ChildProcess.build
#

def initialize(args)
def initialize(*args)
unless args.all? { |e| e.kind_of?(String) }
raise ArgumentError, "all arguments must be String: #{args.inspect}"
end
Expand Down
10 changes: 1 addition & 9 deletions lib/childprocess/windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,12 @@ module Lib
extend FFI::Library

def self.msvcrt_name
host_part = RbConfig::CONFIG['host_os'].split("_")[1]
manifest = File.join(RbConfig::CONFIG['bindir'], 'ruby.exe.manifest')

if host_part && host_part.to_i > 80 && File.exists?(manifest)
"msvcr#{host_part}"
else
"msvcrt"
end
RbConfig::CONFIG['RUBY_SO_NAME'][/msvc\w+/] || 'ucrtbase'
end

ffi_lib "kernel32", msvcrt_name
ffi_convention :stdcall


end # Library
end # Windows
end # ChildProcess
Expand Down