johnnychen94 / Workflows.jl

MIT License
10 stars 1 forks source link

more robust `capture_run` implementation #9

Open johnnychen94 opened 2 years ago

johnnychen94 commented 2 years ago

I can't reproduce this locally, but it seems that CI occasionally fails for capture_run when there exist multiple lines printed to stdout.

Thus for now the @__STDOUT__ and capture = true usage should be considered experimental.

error log ```txt [ Info: run runners test capture_run: Test Failed at /Users/runner/work/Workflows.jl/Workflows.jl/test/runners/shell.jl:19 Expression: String(take!(io)) == "hello world\n" Evaluated: "\n" == "hello world\n" Stacktrace: [1] macro expansion @ ~/hostedtoolcache/julia/1.7.2/x64/share/julia/stdlib/v1.7/Test/src/Test.jl:445 [inlined] [2] macro expansion @ ~/work/Workflows.jl/Workflows.jl/test/runners/shell.jl:19 [inlined] [3] macro expansion @ ~/hostedtoolcache/julia/1.7.2/x64/share/julia/stdlib/v1.7/Test/src/Test.jl:[128](https://github.com/johnnychen94/Workflows.jl/runs/5173342491?check_suite_focus=true#step:5:128)3 [inlined] [4] top-level scope @ ~/work/Workflows.jl/Workflows.jl/test/runners/shell.jl:3 capture_run: Test Failed at /Users/runner/work/Workflows.jl/Workflows.jl/test/runners/shell.jl:25 Expression: String(take!(io)) == "hello world\n" Evaluated: "\n" == "hello world\n" Stacktrace: [1] macro expansion @ ~/hostedtoolcache/julia/1.7.2/x64/share/julia/stdlib/v1.7/Test/src/Test.jl:445 [inlined] [2] macro expansion @ ~/work/Workflows.jl/Workflows.jl/test/runners/shell.jl:25 [inlined] [3] macro expansion @ ~/hostedtoolcache/julia/1.7.2/x64/share/julia/stdlib/v1.7/Test/src/Test.jl:1283 [inlined] [4] top-level scope @ ~/work/Workflows.jl/Workflows.jl/test/runners/shell.jl:3 capture_run: Test Failed at /Users/runner/work/Workflows.jl/Workflows.jl/test/runners/shell.jl:46 Expression: String(take!(io)) == "hello \n\n\n" Evaluated: "hello \n\n\nworld\n\n\n" == "hello \n\n\n" Stacktrace: [1] macro expansion @ ~/hostedtoolcache/julia/1.7.2/x64/share/julia/stdlib/v1.7/Test/src/Test.jl:445 [inlined] [2] macro expansion @ ~/work/Workflows.jl/Workflows.jl/test/runners/shell.jl:46 [inlined] [3] macro expansion @ ~/hostedtoolcache/julia/1.7.2/x64/share/julia/stdlib/v1.7/Test/src/Test.jl:1283 [inlined] [4] top-level scope @ ~/work/Workflows.jl/Workflows.jl/test/runners/shell.jl:3 capture_run: Test Failed at /Users/runner/work/Workflows.jl/Workflows.jl/test/runners/shell.jl:47 Expression: rst == "world" Evaluated: "" == "world" Stacktrace: [1] macro expansion @ ~/hostedtoolcache/julia/1.7.2/x64/share/julia/stdlib/v1.7/Test/src/Test.jl:445 [inlined] [2] macro expansion @ ~/work/Workflows.jl/Workflows.jl/test/runners/shell.jl:47 [inlined] [3] macro expansion @ ~/hostedtoolcache/julia/1.7.2/x64/share/julia/stdlib/v1.7/Test/src/Test.jl:1283 [inlined] [4] top-level scope @ ~/work/Workflows.jl/Workflows.jl/test/runners/shell.jl:3 ```
johnnychen94 commented 2 years ago

I've seen such issues on macOS CI, but I can never reproduce it locally on my macOS.