util: Ignore errors in clear_hupcl (allows OSX to run)

Signed-off-by: Lyle Cheatham <hello@lylecheatham.com>
This commit is contained in:
LyleCheatham 2019-03-21 17:55:15 -04:00 committed by Kevin O'Connor
parent f7cb0875f4
commit 1235972b77
1 changed files with 4 additions and 1 deletions

View File

@ -20,7 +20,10 @@ def set_nonblock(fd):
def clear_hupcl(fd): def clear_hupcl(fd):
attrs = termios.tcgetattr(fd) attrs = termios.tcgetattr(fd)
attrs[2] = attrs[2] & ~termios.HUPCL attrs[2] = attrs[2] & ~termios.HUPCL
try:
termios.tcsetattr(fd, termios.TCSADRAIN, attrs) termios.tcsetattr(fd, termios.TCSADRAIN, attrs)
except termios.error:
pass
# Support for creating a pseudo-tty for emulating a serial port # Support for creating a pseudo-tty for emulating a serial port
def create_pty(ptyname): def create_pty(ptyname):