The Erlang's code server sends the error message (`[error] Can't load module ':lists' that resides in sticky dir`) to Erlang's `:logger`; the Elixir's `Logger` is added as a handler of the Erlang's `:logger`; and the `ExUnit.CaptureLog` proxy is added as a handler of Elixir's `Logger` when `capture_log/2` is used (and the `:console` backend is removed).
Thanks to `Logger.flush/0`, we can be sure that all the messages sent to Elixir's `Logger` during the execution of the function are consumed by all the Elixir's `Logger` handlers. However, that function does not have any effect on Erlang's `:logger`, nor `:logger` provides a similar functionality (or at least I haven't found one).
That's why, due to race conditions, the error is printed instead of being captured.