diff --git a/Gemfile b/Gemfile index ba9393b..8a1b9fe 100644 --- a/Gemfile +++ b/Gemfile @@ -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? diff --git a/lib/childprocess/unix/platform/arm64-macosx.rb b/lib/childprocess/unix/platform/arm64-macosx.rb new file mode 100644 index 0000000..fc0383d --- /dev/null +++ b/lib/childprocess/unix/platform/arm64-macosx.rb @@ -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 diff --git a/spec/childprocess_spec.rb b/spec/childprocess_spec.rb index 89bb235..ffd7240 100644 --- a/spec/childprocess_spec.rb +++ b/spec/childprocess_spec.rb @@ -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 diff --git a/spec/io_spec.rb b/spec/io_spec.rb index 17bd526..cd3777d 100644 --- a/spec/io_spec.rb +++ b/spec/io_spec.rb @@ -138,7 +138,7 @@ stdin.close process.poll_for_exit(exit_timeout) - ensure + ensure out_receiver.close out.close end