Turned off Ctrl+C processing by Windows shell
Signed-off-by: Brendan Dixon <brendand@microsoft.com>
This commit is contained in:
parent
34332b8151
commit
a15746e7cf
3 changed files with 25 additions and 5 deletions
|
@ -5,6 +5,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/docker/pkg/term/winconsole"
|
"github.com/docker/docker/pkg/term/winconsole"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -57,6 +58,7 @@ func GetWinsize(fd uintptr) (*Winsize, error) {
|
||||||
// SetWinsize sets the size of the given terminal connected to the passed file descriptor.
|
// SetWinsize sets the size of the given terminal connected to the passed file descriptor.
|
||||||
func SetWinsize(fd uintptr, ws *Winsize) error {
|
func SetWinsize(fd uintptr, ws *Winsize) error {
|
||||||
// TODO(azlinux): Implement SetWinsize
|
// TODO(azlinux): Implement SetWinsize
|
||||||
|
logrus.Debugf("[windows] SetWinsize: WARNING -- Unsupported method invoked")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,11 +122,10 @@ func MakeRaw(fd uintptr) (*State, error) {
|
||||||
mode &^= winconsole.ENABLE_ECHO_INPUT
|
mode &^= winconsole.ENABLE_ECHO_INPUT
|
||||||
mode &^= winconsole.ENABLE_LINE_INPUT
|
mode &^= winconsole.ENABLE_LINE_INPUT
|
||||||
mode &^= winconsole.ENABLE_MOUSE_INPUT
|
mode &^= winconsole.ENABLE_MOUSE_INPUT
|
||||||
// TODO(azlinux): Enable window input to handle window resizing
|
mode &^= winconsole.ENABLE_WINDOW_INPUT
|
||||||
mode |= winconsole.ENABLE_WINDOW_INPUT
|
mode &^= winconsole.ENABLE_PROCESSED_INPUT
|
||||||
|
|
||||||
// Enable these modes
|
// Enable these modes
|
||||||
mode |= winconsole.ENABLE_PROCESSED_INPUT
|
|
||||||
mode |= winconsole.ENABLE_EXTENDED_FLAGS
|
mode |= winconsole.ENABLE_EXTENDED_FLAGS
|
||||||
mode |= winconsole.ENABLE_INSERT_MODE
|
mode |= winconsole.ENABLE_INSERT_MODE
|
||||||
mode |= winconsole.ENABLE_QUICK_EDIT_MODE
|
mode |= winconsole.ENABLE_QUICK_EDIT_MODE
|
||||||
|
|
|
@ -12,6 +12,8 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/Sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -593,6 +595,7 @@ func (term *WindowsTerminal) HandleOutputCommand(handle uintptr, command []byte)
|
||||||
n = len(command)
|
n = len(command)
|
||||||
|
|
||||||
parsedCommand := parseAnsiCommand(command)
|
parsedCommand := parseAnsiCommand(command)
|
||||||
|
logrus.Debugf("[windows] HandleOutputCommand: %v", parsedCommand)
|
||||||
|
|
||||||
// console settings changes need to happen in atomic way
|
// console settings changes need to happen in atomic way
|
||||||
term.outMutex.Lock()
|
term.outMutex.Lock()
|
||||||
|
@ -648,6 +651,7 @@ func (term *WindowsTerminal) HandleOutputCommand(handle uintptr, command []byte)
|
||||||
column = int16(screenBufferInfo.Window.Right) + 1
|
column = int16(screenBufferInfo.Window.Right) + 1
|
||||||
}
|
}
|
||||||
// The numbers are not 0 based, but 1 based
|
// The numbers are not 0 based, but 1 based
|
||||||
|
logrus.Debugf("[windows] HandleOutputCommmand: Moving cursor to (%v,%v)", column-1, line-1)
|
||||||
if err := setConsoleCursorPosition(handle, false, column-1, line-1); err != nil {
|
if err := setConsoleCursorPosition(handle, false, column-1, line-1); err != nil {
|
||||||
return n, err
|
return n, err
|
||||||
}
|
}
|
||||||
|
@ -1038,8 +1042,7 @@ func (term *WindowsTerminal) HandleInputSequence(fd uintptr, command []byte) (n
|
||||||
}
|
}
|
||||||
|
|
||||||
func marshal(c COORD) uintptr {
|
func marshal(c COORD) uintptr {
|
||||||
// works only on intel-endian machines
|
return uintptr(*((*DWORD)(unsafe.Pointer(&c))))
|
||||||
return uintptr(uint32(uint32(uint16(c.Y))<<16 | uint32(uint16(c.X))))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsConsole returns true if the given file descriptor is a terminal.
|
// IsConsole returns true if the given file descriptor is a terminal.
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package winconsole
|
package winconsole
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -206,6 +207,21 @@ func (c *ansiCommand) getParam(index int) string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ac *ansiCommand) String() string {
|
||||||
|
return fmt.Sprintf("0x%v \"%v\" (\"%v\")",
|
||||||
|
bytesToHex(ac.CommandBytes),
|
||||||
|
ac.Command,
|
||||||
|
strings.Join(ac.Parameters, "\",\""))
|
||||||
|
}
|
||||||
|
|
||||||
|
func bytesToHex(b []byte) string {
|
||||||
|
hex := make([]string, len(b))
|
||||||
|
for i, ch := range b {
|
||||||
|
hex[i] = fmt.Sprintf("%X", ch)
|
||||||
|
}
|
||||||
|
return strings.Join(hex, "")
|
||||||
|
}
|
||||||
|
|
||||||
func parseInt16OrDefault(s string, defaultValue int16) (n int16, err error) {
|
func parseInt16OrDefault(s string, defaultValue int16) (n int16, err error) {
|
||||||
if s == "" {
|
if s == "" {
|
||||||
return defaultValue, nil
|
return defaultValue, nil
|
||||||
|
|
Loading…
Reference in a new issue