@@ -252,22 +252,27 @@ function runtest(f, name, init_code, color)
252252 GC. gc (true )
253253 Random. seed! (1 )
254254
255- mktemp () do path, io
256- stats = redirect_stdio (stdout = io, stderr = io) do
257- # @testset CustomTestRecord switches the all lower-level testset to our custom testset,
258- # so we need to have two layers here such that the user-defined testsets are using `DefaultTestSet`.
259- # This also guarantees our invariant about `WorkerTestSet` containing a single `DefaultTestSet`.
260- @timed @testset WorkerTestSet " placeholder" begin
261- @testset DefaultTestSet $ name begin
262- $ f
263- end
255+ pipe = Pipe ()
256+ pipe_initialized = Channel {Nothing} (1 )
257+ reader = @async begin
258+ take! (pipe_initialized)
259+ read (pipe, String)
260+ end
261+ stats = redirect_stdio (stdout = pipe, stderr = pipe) do
262+ put! (pipe_initialized, nothing )
263+
264+ # @testset CustomTestRecord switches the all lower-level testset to our custom testset,
265+ # so we need to have two layers here such that the user-defined testsets are using `DefaultTestSet`.
266+ # This also guarantees our invariant about `WorkerTestSet` containing a single `DefaultTestSet`.
267+ @timed @testset WorkerTestSet " placeholder" begin
268+ @testset DefaultTestSet $ name begin
269+ $ f
264270 end
265271 end
266- close (io)
267- output = read (path, String)
268- (; testset= stats. value, output, stats. time, stats. bytes, stats. gctime)
269-
270272 end
273+ close (pipe. in)
274+ output = fetch (reader)
275+ (; testset= stats. value, output, stats. time, stats. bytes, stats. gctime)
271276 end
272277
273278 # process results
0 commit comments