windows: Why `initStdios` ignores `GetConsoleMode` errors?
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- go
- Domain
- cli, operating-systems
Research direction
Start in console_windows.go, especially the initStdios and newMaster code around lines 32-67, and trace how GetConsoleMode failures are handled for redirected standard handles. Compare the behavior with the linked containerd/console implementation and verify whether returning an error or opening CONIN$/CONOUT$ preserves expected SetConsoleMode behavior. Done means the handling is decided and covered by an appropriate test or documented rationale.
Written by the indexing model from the issue text.
Description
Hey there,
Frankly good designed library.
Specifically I am not aware how golang std works but if it gets its streams using GetStdHandle GetConsoleMode will fail if a stream was redirected.
https://stackoverflow.com/questions/33476316/win32-getconsolemode-error-code-6
GetConsoleMode takes A handle to the console input buffer or the console screen buffer.
https://docs.microsoft.com/en-us/windows/console/getconsolemode
The standard handles of a process may be redirected by a call to SetStdHandle, in which case GetStdHandle returns the redirected handle. If the standard handles have been redirected, you can specify the CONIN$ value in a call to the CreateFile function to get a handle to a console's input buffer. Similarly, you can specify the CONOUT$ value to get a handle to a console's active screen buffer.
https://docs.microsoft.com/en-us/windows/console/getstdhandle
If this is the case it could be handled by oppening CONIN CONOUT. (I am not sure though how SetConsoleMode will work on such handles).
But my point is if GetConsoleMode fails maybe it'd better to return error in newMaster?
Thank you.
- Dominant language
- Go
- Stars
- 201
- Forks
- 60
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from containerd/console
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
containerd/console#91 · 4 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
containerd/console#87 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
containerd/console#82 ·
-
console.NewPty panics on macOSPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
containerd/console#79 · 2 comments · 3 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
containerd/console#71 ·
All issues in containerd/console
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
JuliusBrussee/caveman#1189 ·
Maintainers usually reply within 1 day
-
agent-review-finding chore
Difficulty 2/5 Half a day Newbie friendliness 78/100
jordansmall/spindrift#4497 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug from-studio
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
esengine/DeepSeek-Reasonix#12044 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 82/100