Skip to content

Commit fd96a68

Browse files
committed
Update ractor_test.rb per review
1 parent eb157e5 commit fd96a68

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

test/prism/ractor_test.rb

Lines changed: 7 additions & 14 deletions
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,18 +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-
73-
Process.wait(pid)
74-
result
7568
end
7669
end
7770
end

0 commit comments

Comments
 (0)