MCPcopy Create free account
hub / github.com/linuxkit/linuxkit / hypervConfigureConsole

Function hypervConfigureConsole

src/cmd/linuxkit/hyperv_windows.go:68–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66)
67
68func hypervConfigureConsole() error {
69 // Turn on VT handling on all std handles, if possible. This might
70 // fail on older windows version, but we'll ignore that for now
71 // Also disable local echo
72
73 fd := os.Stdin.Fd()
74 if hypervStdinMode, err := winterm.GetConsoleMode(fd); err == nil {
75 if err = winterm.SetConsoleMode(fd, hypervStdinMode|enableVirtualTerminalInput); err != nil {
76 log.Warn("VT Processing is not supported on stdin")
77
78 }
79 }
80
81 fd = os.Stdout.Fd()
82 if hypervStdoutMode, err := winterm.GetConsoleMode(fd); err == nil {
83 if err = winterm.SetConsoleMode(fd, hypervStdoutMode|enableVirtualTerminalProcessing|disableNewlineAutoReturn); err != nil {
84 log.Warn("VT Processing is not supported on stdout")
85 }
86 }
87
88 fd = os.Stderr.Fd()
89 if hypervStderrMode, err := winterm.GetConsoleMode(fd); err == nil {
90 if err = winterm.SetConsoleMode(fd, hypervStderrMode|enableVirtualTerminalProcessing|disableNewlineAutoReturn); err != nil {
91 log.Warn("VT Processing is not supported on stderr")
92 }
93 }
94 return nil
95}
96
97func hypervRestoreConsole() {
98 winterm.SetConsoleMode(os.Stdin.Fd(), hypervStdinMode)

Callers 1

hypervStartConsoleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected