mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
* Set character mode for input stream * Move watchers in receiver + sync when p pressed * Integration tests manual sync * Add a console to DevSession * Vendor * Skip pressKey tests on Windows * Add interactive test for p press * Add info about pressing p key * Doc * Review * Rephrase Manul sync * Fix HotReloadCapable * Document timers * Document enableCharInput * Document geyKey and getKeyWatcher functions * Avoid to Kill in AfterEach after running Kill before
25 lines
739 B
Go
25 lines
739 B
Go
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
|
|
|
package watch
|
|
|
|
import (
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
// enableCharInput is inspired from the Unix implementation of MakeRaw in golang.org/x/term
|
|
// It enables the treatment of input stream char by char instead of line by line
|
|
// See https://man7.org/linux/man-pages/man3/termios.3.html for reference
|
|
func enableCharInput(fd int) error {
|
|
termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
termios.Lflag &^= unix.ICANON
|
|
if err := unix.IoctlSetTermios(fd, ioctlWriteTermios, termios); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|