From 575f71bdbec5480274c76e502f1110e80bb7ae0a Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Sat, 9 Jul 2016 12:49:27 -0400 Subject: [PATCH] Add a test that uvloop doesn't set FD_CLOEXEC to stdin/stdout/stderr Issue #40. --- tests/test_base.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_base.py b/tests/test_base.py index 5b1f0ff..57bc6c3 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -1,4 +1,5 @@ import asyncio +import fcntl import logging import threading import time @@ -505,6 +506,12 @@ class TestBaseUV(_TestBase, UVTestCase): self.assertIs(fut._loop, self.loop) fut.cancel() + def test_loop_std_files_cloexec(self): + # See https://github.com/MagicStack/uvloop/issues/40 for details. + for fd in {0, 1, 2}: + flags = fcntl.fcntl(fd, fcntl.F_GETFD) + self.assertFalse(flags & fcntl.FD_CLOEXEC) + class TestBaseAIO(_TestBase, AIOTestCase): pass