I had this segfault issue https://github.com/JuliaLang/julia/issues/34620 while writing https://github.com/tkf/TmuxDisplays.jl. I think we'd better "vendor" https://github.com/JuliaLang/julia/pull/34623 and then define some kind of fallback when the stream is closed. See also https://github.com/JuliaLang/julia/issues/26687