()
| 66 | ) |
| 67 | |
| 68 | func 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 | |
| 97 | func hypervRestoreConsole() { |
| 98 | winterm.SetConsoleMode(os.Stdin.Fd(), hypervStdinMode) |
no outgoing calls
no test coverage detected