mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
test: put tty in blocking mode after test
Tests can leave the tty in non-blocking mode. If the test runner tries to print to stdout/stderr after that and the tty buffer is full, it'll die with a EAGAIN OSError. Ergo, put the tty back in blocking mode before proceeding.
This commit is contained in:
parent
4e1a2f9a89
commit
fa3bfc3a66
@ -400,10 +400,20 @@ class TestCase(object):
|
||||
|
||||
def Run(self):
|
||||
self.BeforeRun()
|
||||
|
||||
try:
|
||||
result = self.RunCommand(self.GetCommand())
|
||||
finally:
|
||||
self.AfterRun(result)
|
||||
# Tests can leave the tty in non-blocking mode. If the test runner
|
||||
# tries to print to stdout/stderr after that and the tty buffer is
|
||||
# full, it'll die with a EAGAIN OSError. Ergo, put the tty back in
|
||||
# blocking mode before proceeding.
|
||||
if sys.platform != 'win32':
|
||||
from fcntl import fcntl, F_GETFL, F_SETFL
|
||||
from os import O_NONBLOCK
|
||||
for fd in 0,1,2: fcntl(fd, F_SETFL, ~O_NONBLOCK & fcntl(fd, F_GETFL))
|
||||
|
||||
self.AfterRun(result)
|
||||
return result
|
||||
|
||||
def Cleanup(self):
|
||||
|
Loading…
Reference in New Issue
Block a user