AshlinHarris / Spinners.jl

Command line spinners in Julia with Unicode support
MIT License
13 stars 1 forks source link

IO redirection in a let block causes pipe errors on Linux and MacOS #63

Closed AshlinHarris closed 1 year ago

AshlinHarris commented 1 year ago
let
        os = stdout;
        (rd, wr) = redirect_stdout();

        @spinner "abc" new_variable = 4
        @test new_variable == 4
        @spinner "◒◐◓◑" new_variable_2 = 5
        @test new_variable_2 == 5

        redirect_stdout(os);
        close(wr);
end

This scope test from test/runtests.jl failed with a pipe error on Linux and MacOS, but not on Windows. Moving the line (rd, wr) = redirect_stdout(); outside of the let...end block resolves the issue.

AshlinHarris commented 1 year ago

I've adjusted this from the test file. However, I'll look into the root cause as well, since I want to be sure @spinner doesn't cause any working code to fail.