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

Add apple m1/arm64 support #177

Merged
merged 4 commits into from
Jun 3, 2021
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
14 changes: 1 addition & 13 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,4 @@ gemspec
# Used for local development/testing only
gem 'rake'

if RUBY_VERSION =~ /^1\./
gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version

# ffi gem for Windows requires Ruby 2.x on/after this version
gem 'ffi', '< 1.9.15' if ENV['CHILDPROCESS_POSIX_SPAWN'] == 'true' || Gem.win_platform?
elsif Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2')
# Ruby 2.0/2.1 support only ffi before 1.10
gem 'ffi', '~> 1.9.0' if ENV['CHILDPROCESS_POSIX_SPAWN'] == 'true' || Gem.win_platform?
else
gem 'ffi' if ENV['CHILDPROCESS_POSIX_SPAWN'] == 'true' || Gem.win_platform?
end
gem 'ffi' if ENV['CHILDPROCESS_POSIX_SPAWN'] == 'true' || Gem.win_platform?
11 changes: 11 additions & 0 deletions lib/childprocess/unix/platform/arm64-macosx.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module ChildProcess::Unix::Platform
SIZEOF = {
:posix_spawn_file_actions_t => 8,
:posix_spawnattr_t => 8,
:sigset_t => 4
}
POSIX_SPAWN_RESETIDS = 1
POSIX_SPAWN_SETPGROUP = 2
POSIX_SPAWN_SETSIGDEF = 4
POSIX_SPAWN_SETSIGMASK = 8
end
2 changes: 1 addition & 1 deletion spec/childprocess_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@

Tempfile.open('grandparent_out') do |gp_file|
# Create a parent and detached child process that will spit out their PID. Make sure that the child process lasts longer than the parent.
p_process = ruby("require 'childprocess' ; c_process = ChildProcess.build('ruby', '-e', 'puts \\\"Child PID: \#{Process.pid}\\\" ; sleep 5') ; c_process.io.inherit! ; c_process.detach = true ; c_process.start ; puts \"Child PID: \#{c_process.pid}\" ; puts \"Parent PID: \#{Process.pid}\"")
p_process = ruby("$: << 'lib'; require 'childprocess' ; c_process = ChildProcess.build('ruby', '-e', 'puts \\\"Child PID: \#{Process.pid}\\\" ; sleep 5') ; c_process.io.inherit! ; c_process.detach = true ; c_process.start ; puts \"Child PID: \#{c_process.pid}\" ; puts \"Parent PID: \#{Process.pid}\"")
p_process.io.stdout = p_process.io.stderr = gp_file

# Let the parent process die
Expand Down
2 changes: 1 addition & 1 deletion spec/io_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@

stdin.close
process.poll_for_exit(exit_timeout)
ensure
ensure
out_receiver.close
out.close
end
Expand Down