diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-01-07 03:59:08 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-01-07 03:59:10 +0100 |
commit | fa3bfc3a66cc081b0aacacc2124a7666c73c6288 (patch) | |
tree | dbd3d29a168818e806d9ffb6738675ea198f5ee1 /tools | |
parent | 4e1a2f9a89e96c36919c8cfffb7edd1936143c80 (diff) | |
download | android-node-v8-fa3bfc3a66cc081b0aacacc2124a7666c73c6288.tar.gz android-node-v8-fa3bfc3a66cc081b0aacacc2124a7666c73c6288.tar.bz2 android-node-v8-fa3bfc3a66cc081b0aacacc2124a7666c73c6288.zip |
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.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/test.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/test.py b/tools/test.py index e94ad24f83..29e850dacb 100755 --- a/tools/test.py +++ b/tools/test.py @@ -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): |