vscode-go icon indicating copy to clipboard operation
vscode-go copied to clipboard

[Windows 11] internalConsole does not send EOF on stdin

Open tonymet opened this issue 4 months ago • 0 comments

What version of Go, VS Code & VS Code Go extension are you using?

Version Information
go version go1.24.5 windows/amd64
Get-CimInstance Win32_OperatingSystem) | Select-Object Caption, 
Microsoft Windows 11 Pro 10.0.26120
  • go version

    • go version go1.24.5 windows/amd64
  • gopls version_.

 gopls -v version
Build info
----------
golang.org/x/tools/gopls v0.19.1
    golang.org/x/tools/[email protected] h1:Yodhp3rnpnag60lVZrYPYbGMxTlTCIAj/B2Rv7AKuhA=
    github.com/BurntSushi/[email protected] h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs=
    github.com/fatih/[email protected] h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8=
    github.com/fatih/[email protected] h1:dDSgAjoOMp8da3egfz0t2S+t8RGOpEmEXZubcGuc0Bg=
    github.com/fatih/[email protected] h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
    github.com/google/[email protected] h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
    golang.org/x/exp/[email protected] h1:Br3+0EZZohShrmVVc85znGpxw7Ca8hsUJlrdT/JQGw8=
    golang.org/x/[email protected] h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w=
    golang.org/x/[email protected] h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
    golang.org/x/[email protected] h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
    golang.org/x/[email protected] h1:RXY2+rSHXvxO2Y+gKrPjYVaEoGOqh3VEXFhnWAt1Irg=
    golang.org/x/[email protected] h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
    golang.org/x/[email protected] h1:XnjOegqwH6kBJoae6InSGbIFPHcLtUT/Eq8HjrZKbmQ=
    golang.org/x/[email protected] h1:Ju8QsuyhX3Hk8ma3CesTbO8vfJD9EvUBgHvkxHBzj0I=
    honnef.co/go/[email protected] h1:fj8r9irJSpolAGUdZBxJIRY3lLc4jH2Dt4lwnWyWwpw=
    mvdan.cc/[email protected] h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU=
    mvdan.cc/xurls/[email protected] h1:3NTZpeTxYVWNSokW3MKeyVkz/j7uYXYiMtXRUfmjbgI=
go: go1.24.5
  • vs-code version
1.102.1
7adae6a56e34cb64d08899664b814cf620465925
x64
  • go-vs code extension
Version
0.48.0
Last Updated
2025-06-30, 14:21:12
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.

Share the Go related settings you have added/edited

 "go.testTimeout": "5s",
    "go.testFlags": [
       "-v" 
    ],

Describe the bug

vs-code-go debugger does not send EOF on stdin when console:internalConsole (default) in launch.json . this causes any debug-ee to hang indefinitely until read-timeout

NOTE

  • EOF character for Ctrl-Z on Windows PowerShell and cmd is the ASCII control character SUB (U+001A, hex 0x1A).
  • Unicode-wise, it is U+001A (a control character in the C0 control set).
  • EOF on linux is 0x04 . It's likely that a routine is expecting 0x04 instead of 0x1A

Expected Results

Like Linux, Stdin should be empty and send EOF so the reading program can terminate

Actual Results

Stdin is empty, but never sends EOF . Reading program hangs indefinitely until timeout condition . When breaking into the program, goroutine is sleeping on reading stdin (see stack)

Steps to reproduce the behavior:

See both examples "debug console run", "integrated terminal run" for comparison.

  1. Run on Windows 11
  2. clone and debug https://gist.github.com/tonymet/2c19d78db10d582d1673bf046db2f97d
  3. make sure you run example launch.json with console: internalConsole
  4. Run in debugger
  5. hit pause to break into running code

Screenshots or recordings

Breaking into the running code shows goroutine sleeping at reading Stdin

??? (?:-1)
runtime.systemstack_switch (c:\Program Files\Go\src\runtime\asm_amd64.s:479)
runtime.cgocall (c:\Program Files\Go\src\runtime\cgocall.go:185)
runtime.syscall_syscalln (c:\Program Files\Go\src\runtime\syscall_windows.go:521)
syscall.Syscall6 (c:\Program Files\Go\src\runtime\syscall_windows.go:463)
syscall.readFile (c:\Program Files\Go\src\syscall\zsyscall_windows.go:1020)
syscall.ReadFile (c:\Program Files\Go\src\syscall\syscall_windows.go:454)
syscall.Read (c:\Program Files\Go\src\syscall\syscall_windows.go:433)
poll.(*FD).Read (c:\Program Files\Go\src\internal\poll\fd_windows.go:424)
os.(*File).read (c:\Program Files\Go\src\os\file_posix.go:29)
os.(*File).Read (c:\Program Files\Go\src\os\file.go:124)
bufio.(*Scanner).Scan (c:\Program Files\Go\src\bufio\scan.go:219)
main.main (c:\Users\tonymet\source\vs-code-go-cli-test\main.go:58)
runtime.main (c:\Program Files\Go\src\runtime\proc.go:283)
runtime.goexit (c:\Program Files\Go\src\runtime\asm_amd64.s:1700)

tonymet avatar Jul 25 '25 16:07 tonymet