Skip to content

Commit acc8e1c

Browse files
committed
ghost: align pty settings
1 parent 5e20d9e commit acc8e1c

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

overlord/ghost.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,10 +1038,9 @@ func (ghost *Ghost) SpawnTTYServer(res *Response) error {
10381038
}
10391039

10401040
termios.Cfmakeraw(&term)
1041-
term.Iflag &= (unix.IXON | unix.IXOFF)
1042-
term.Cflag |= unix.CLOCAL
1043-
term.Ispeed = unix.B115200
1044-
term.Ospeed = unix.B115200
1041+
term.Iflag &^= (unix.IXON | unix.IXOFF) // Disable software flow control
1042+
term.Cflag |= unix.CLOCAL // Ignore modem control lines
1043+
term.Cflag &^= unix.CRTSCTS // Disable hardware flow control
10451044

10461045
if err = termios.Tcsetattr(tty.Fd(), termios.TCSANOW, &term); err != nil {
10471046
return err

py/ghost.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -616,20 +616,12 @@ def SpawnTTYServer(self, unused_var):
616616
else:
617617
fd = os.open(self._tty_device, os.O_RDWR)
618618
tty.setraw(fd)
619-
# 0: iflag
620-
# 1: oflag
621-
# 2: cflag
622-
# 3: lflag
623-
# 4: ispeed
624-
# 5: ospeed
625-
# 6: cc
626-
attr = termios.tcgetattr(fd)
627-
attr[0] &= ~(termios.IXON | termios.IXOFF)
628-
attr[2] |= termios.CLOCAL
629-
attr[2] &= ~termios.CRTSCTS
630-
attr[4] = termios.B115200
631-
attr[5] = termios.B115200
632-
termios.tcsetattr(fd, termios.TCSANOW, attr)
619+
620+
attrs = termios.tcgetattr(fd)
621+
attrs[0] &= ~(termios.IXON | termios.IXOFF) # Disable software flow control
622+
attrs[2] |= termios.CLOCAL # Ignore modem control lines
623+
attrs[2] &= ~termios.CRTSCTS # Disable hardware flow control
624+
termios.tcsetattr(fd, termios.TCSANOW, attrs)
633625

634626
def _ProcessBuffer(buf):
635627
if buf == b'\x04':

0 commit comments

Comments
 (0)