Merge pull request #847 from yousong/poll-eintr

cli: ignore EINTR caused by SIGWINCH when calling poll()
This commit is contained in:
lantz
2018-12-20 11:36:42 -08:00
committed by GitHub
+9
View File
@@ -29,6 +29,8 @@ from subprocess import call
from cmd import Cmd from cmd import Cmd
from os import isatty from os import isatty
from select import poll, POLLIN from select import poll, POLLIN
import select
import errno
import sys import sys
import time import time
import os import os
@@ -459,6 +461,13 @@ class CLI( Cmd ):
# it's possible to interrupt ourselves after we've # it's possible to interrupt ourselves after we've
# read data but before it has been printed. # read data but before it has been printed.
node.sendInt() node.sendInt()
except select.error as e:
# pylint: disable=unpacking-non-sequence
errno_, errmsg = e.args
# pylint: enable=unpacking-non-sequence
if errno_ != errno.EINTR:
error( "select.error: %d, %s" % (errno_, errmsg) )
node.sendInt()
def precmd( self, line ): def precmd( self, line ):
"allow for comments in the cli" "allow for comments in the cli"