lxc/console.go
func (er stdinMirror) Read(p []byte) (int, error) {
	n, err := er.r.Read(p)

	v := rune(p[0])
	if v == '\u0001' && !*er.foundEscape {
		*er.foundEscape = true
		return 0, err
	}

	if v == 'q' && *er.foundEscape {
		select {
		case er.consoleDisconnect <- true:
			return 0, err
		default:
			return 0, err
		}
	}

	*er.foundEscape = false
	return n, err
}
func (er stdinMirror) Read(p []byte) (int, error) {
	n, err := er.r.Read(p)

	v := rune(p[0])
	if v == '\u0001' && !*er.foundEscape {
		*er.foundEscape = true
		return 0, err
	}

	if v == 'q' && *er.foundEscape {
		select {
		case er.consoleDisconnect <- true:
			return 0, err
		default:
			return 0, err
		}
	}

	*er.foundEscape = false
	return n, err
}
func ( er stdinMirror ) Read ( p [ ] byte ) ( int , error ) { n , err := er . r . Read ( p ) v := rune ( p [ 0 ] ) if v == '\u0001' && ! * er . foundEscape { * er . foundEscape = true return 0 , err } if v == 'q' && * er . foundEscape { select { case er . consoleDisconnect <- true : return 0 , err default : return 0 , err } } * er . foundEscape = false return n , err }
// The pty has been switched to raw mode so we will only ever read a single
// byte. The buffer size is therefore uninteresting to us.
The pty has been switched to raw mode so we will only ever read a single byte . The buffer size is therefore uninteresting to us .