Test involving thread spawning failed in GitHub Actions

There is a test in my testset involving thread spawning.

@test begin
...
      repl_closed = Condition()
      start_repl() = begin
        m.start_repl(; output = output)
        notify(repl_closed)
      end
      repl_handle = Threads.@spawn start_repl()
      sleep(1)
      schedule(repl_handle, ErrorException(""), error = true)
...

In the code, m.start_repl() starts a while loop which keeps waiting for readline().

When I ran it locally (both ubuntu 20.04 and MacOS 12), it could pass. However, it kept failing in GitHub Actions, yielding Task not runnable exception.

The strangest part was that when I took control of the CI environment throw the tmate action, and ran the exactly same test script julia --color=yes --project=. -t 1 -e 'import Pkg; Pkg.test(; coverage=true)', it could pass.

P.S. I have tried many different thread settings (empty / 1 / 2 / 4 / “auto”), and none worked.

I have found the cause. It was because when the test was running via GitHub Actions, readline() from stdin worked differently as in a shell environment.