Skip to content

Commit e47078f

Browse files
committed
[ruby/prism] Update ractor_test.rb per review
ruby/prism@fd96a6821f
1 parent ab8b199 commit e47078f

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

test/prism/ractor_test.rb

+7-15
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# frozen_string_literal: true
22

3-
return unless defined?(Ractor)
3+
return if !defined?(Ractor) || !defined?(fork)
44

55
require_relative "test_helper"
66

7-
return if Prism::TestCase.windows?
8-
97
module Prism
108
class RactorTest < TestCase
119
def test_version
@@ -60,19 +58,13 @@ def test_dump_file
6058
# Note that this must be done in a subprocess, otherwise it can mess up
6159
# CRuby's test suite.
6260
def with_ractor(*arguments, &block)
63-
reader, writer = IO.pipe
64-
65-
pid = fork do
66-
reader.close
67-
writer.puts(ignore_warnings { Ractor.new(*arguments, &block) }.take)
61+
IO.popen("-") do |reader|
62+
if reader
63+
reader.gets.chomp
64+
else
65+
puts(ignore_warnings { Ractor.new(*arguments, &block) }.take)
66+
end
6867
end
69-
70-
writer.close
71-
result = reader.gets.chomp
72-
reader.close
73-
74-
Process.wait(pid)
75-
result
7668
end
7769
end
7870
end

0 commit comments

Comments
 (0)