Skip to content

Commit

Permalink
Fix argument delegation
Browse files Browse the repository at this point in the history
Prior to this change, using childprocess in a Ruby 3 environment would
generate `wrong number of arguments` errors.

This commit attempts to address the errors by ensuring that we are
properly delegating arguments in childprocess and the abstract_process
classes.
  • Loading branch information
chelnak authored and sds committed Dec 13, 2023
1 parent 4422792 commit 22b4c09
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit 22b4c09

Please sign in to comment.