hi everyone, readlines function does not finish with Ctrl+d. Tested with julia REPL called from CMD, powershell, Windows Terminal, and from an small program.
No problem with linux.
julia> versioninfo()
Julia Version 1.11.2
Commit 5e9a32e7af (2024-12-01 20:02 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 4 × Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, skylake)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)
Environment:
JULIA_EDITOR = hx.exe
Small program
println("\nEnter some lines, finish with Ctrl+d")
lines=readlines()
println(lines)
In case this is useful to someone more knowledgeable than me:
I tried looking into the stream.jl source code. The difference between Linux and Windows seems to be that wait_readnb(stdin, 1) and entering CTRL+D, sets stdin.status to StatusEOF on Linux, but leaves it at StatusOpen on Windows. I imagine this status change is performed in the ccall in start_reading(stdin) / uv_readcb, but I cannot follow the trail at this point.
Yes, I’ve tried it now, too (PowerShell console, Windows Command Prompt, Cygwin, all running inside Windows-Terminal) Neither Ctrl-D nor Ctrl-Z works for any of them. Running Cygwin in the Cygwin-supplied mintty console doesn’t work either.
Running under WSL (also inside Windows-Terminal) does respond correctly: Ctrl-D terminates readlines() correctly, Ctrl-Z terminates the REPL session.
EDIT: In WSL, Ctrl-Z puts the REPL into the background, as I should have remembered: so the REPL is still running.