Possible ANSI bug that surfaces in Docker/ConEmu #339

Closed
opened 2026-01-30 21:49:27 +00:00 by claunia · 2 comments
Owner

Originally created by @edrevo on GitHub (Aug 3, 2018).

After reading your Windows Command Line post series, I think that these two bugs: https://github.com/Maximus5/ConEmu/issues/958 and https://github.com/moby/moby/issues/28814, which seem to be bouncing off between the moby and ConEmu projects, might actually be a bug in conhost.

The bug repro is dead simple: open up ConEmu and type echo 'FROM hello-world' | docker build -t temp -. This will fail because docker assumes ConEmu has ANSI support (28cca5dcaa/pkg/term/term_windows.go (L74-L79)), which I'm guessing actually happens in conhost as per this image:

I can repro this on Microsoft Windows [Versión 10.0.17134.112]

Originally created by @edrevo on GitHub (Aug 3, 2018). After reading your [Windows Command Line post series](https://blogs.msdn.microsoft.com/commandline/2018/06/20/windows-command-line-backgrounder/), I think that these two bugs: https://github.com/Maximus5/ConEmu/issues/958 and https://github.com/moby/moby/issues/28814, which seem to be bouncing off between the moby and ConEmu projects, might actually be a bug in conhost. The bug repro is dead simple: open up ConEmu and type `echo 'FROM hello-world' | docker build -t temp -`. This will fail because docker assumes ConEmu has ANSI support (https://github.com/moby/moby/blob/28cca5dcaa2aa21123805d7f2d51916ea1f38d71/pkg/term/term_windows.go#L74-L79), which I'm guessing actually happens in conhost as per this image: ![](https://msdnshared.blob.core.windows.net/media/2018/08/command-line-console-internals-800x455.png) I can repro this on `Microsoft Windows [Versión 10.0.17134.112]`
claunia added the Resolution-External label 2026-01-30 21:49:27 +00:00
Author
Owner

@parkovski commented on GitHub (Aug 4, 2018):

Just looked at this quickly, I’d guess the bug is in https://github.com/moby/moby/blob/master/pkg/term/windows/console.go

They return true for IsConsole if it is wrapper in an ANSI reader. If the underlying handle is a pipe and not a direct console handle and you call PeekConsoleInput, you’ll get the error you’re seeing. This looks like it only happens under ConEmu or ConsoleZ when input is piped based on the snippet you linked to.

@parkovski commented on GitHub (Aug 4, 2018): Just looked at this quickly, I’d guess the bug is in https://github.com/moby/moby/blob/master/pkg/term/windows/console.go They return true for IsConsole if it is wrapper in an ANSI reader. If the underlying handle is a pipe and not a direct console handle and you call PeekConsoleInput, you’ll get the error you’re seeing. This looks like it only happens under ConEmu or ConsoleZ when input is piped based on the snippet you linked to.
Author
Owner

@zadjii-msft commented on GitHub (Aug 8, 2018):

Considering this seems to be a bug in moby, not conhost, I'm gonna close this as external.

@zadjii-msft commented on GitHub (Aug 8, 2018): Considering this seems to be a bug in moby, not conhost, I'm gonna close this as external.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#339