# Problem with readlines function in windows

**URL:** <https://discourse.julialang.org/t/problem-with-readlines-function-in-windows/123970>\
**Category:** General Usage\
**Tags:** bug, repl, io\
**Created:** [December 18, 2024, 10:01pm UTC](https://discourse.julialang.org/t/problem-with-readlines-function-in-windows/123970 "2024-12-18T22:01:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![marodriguezs](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@marodriguezs](https://discourse.julialang.org/u/marodriguezs)\
**Post date:** [December 18, 2024, 10:01pm UTC](https://discourse.julialang.org/t/problem-with-readlines-function-in-windows/123970/1 "2024-12-18T22:01:24Z")

</div>

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
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

```julia
println("\nEnter some lines, finish with Ctrl+d")
lines=readlines()
println(lines)

```

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [December 18, 2024, 10:14pm UTC](https://discourse.julialang.org/t/problem-with-readlines-function-in-windows/123970/2 "2024-12-18T22:14:31Z")

</div>

Linking [related thread](https://discourse.julialang.org/t/cant-terminate-input-for-readlines-in-vscode-repl-windows-10/111896/2).

---

<div class="post-metadata">

**Author:** ![magister-ludi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/magister-ludi/32/4003_2.png) [@magister-ludi](https://discourse.julialang.org/u/magister-ludi)\
**Post date:** [December 19, 2024, 2:36am UTC](https://discourse.julialang.org/t/problem-with-readlines-function-in-windows/123970/3 "2024-12-19T02:36:57Z")

</div>

I haven’t tried it (on my phone right now), but the termination signal on Windows has traditionally been `Ctrl-Z`.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [December 19, 2024, 8:25am UTC](https://discourse.julialang.org/t/problem-with-readlines-function-in-windows/123970/4 "2024-12-19T08:25:31Z")

</div>

> [@magister-ludi](#):
>
> termination signal on Windows has traditionally been `Ctrl-Z`

This doesn’t work for me (Win11 and Julia Version 1.11.2’s REPL)

---

<div class="post-metadata">

**Author:** ![eldee](https://avatars.discourse-cdn.com/v4/letter/e/b5a626/32.png) [@eldee](https://discourse.julialang.org/u/eldee)\
**Post date:** [December 19, 2024, 9:24am UTC](https://discourse.julialang.org/t/problem-with-readlines-function-in-windows/123970/5 "2024-12-19T09:24:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![magister-ludi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/magister-ludi/32/4003_2.png) [@magister-ludi](https://discourse.julialang.org/u/magister-ludi)\
**Post date:** [December 19, 2024, 10:21am UTC](https://discourse.julialang.org/t/problem-with-readlines-function-in-windows/123970/6 "2024-12-19T10:21:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [December 19, 2024, 11:02am UTC](https://discourse.julialang.org/t/problem-with-readlines-function-in-windows/123970/7 "2024-12-19T11:02:08Z")

</div>

[Closing stdin by pressing Ctrl+D does doesn’t work on Windows · Issue #36645 · JuliaLang/julia](https://github.com/JuliaLang/julia/issues/36645)  
fwiw, some button mashing in the v1.11.2 REPL via Windows PowerShell:

```julia
julia> readlines()
^Q^Q^W^W^E^E^R^R^T^T^Y^Y^U^U ^O^O^P^P
^A^A^D^D^F^F^G^K^K^L^L
^Z^Z^X^X^B^B^N^N

ERROR: InterruptException:

```

Skipped V (paste) and left C to the end for the interrupt.
