Skip to content

Commit a237f24

Browse files
committed
add IO.pipe to communicate results
1 parent 50f3b56 commit a237f24

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

run.rb

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,30 @@ def fuzz_function_exists?(file_path)
3030
exit(1)
3131
end
3232

33+
reader, writer = IO.pipe
34+
3335
fork do
34-
STDOUT.reopen('/dev/null')
35-
STDIN.reopen('/dev/null')
36+
loop do
37+
puts "reading from IO pipe: #{reader.gets.strip}"
38+
end
39+
end
3640

37-
Coverage.start(:all)
41+
loop do
42+
fork do
43+
STDOUT.reopen('/dev/null')
44+
STDIN.reopen('/dev/null')
3845

39-
begin
40-
load(file_path)
41-
fuzz(Random.new.bytes(10))
42-
rescue => e
43-
puts "Encountered an exception: #{e}"
44-
exit(1)
45-
end
46+
Coverage.start(:all)
4647

47-
p Coverage.result
48-
end
48+
begin
49+
load(file_path)
50+
fuzz(Random.new.bytes(10))
51+
rescue => e
52+
puts "Encountered an exception: #{e}"
53+
exit(1)
54+
end
4955

50-
Process.wait
56+
writer.puts(Coverage.result.hash)
57+
end
58+
Process.wait
59+
end

0 commit comments

Comments
 (0)