Skip to content

Commit 575f71b

Browse files
committed
Add a test that uvloop doesn't set FD_CLOEXEC to stdin/stdout/stderr
Issue #40.
1 parent af4ab22 commit 575f71b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/test_base.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
import fcntl
23
import logging
34
import threading
45
import time
@@ -505,6 +506,12 @@ def test_loop_create_future(self):
505506
self.assertIs(fut._loop, self.loop)
506507
fut.cancel()
507508

509+
def test_loop_std_files_cloexec(self):
510+
# See https://github.com/MagicStack/uvloop/issues/40 for details.
511+
for fd in {0, 1, 2}:
512+
flags = fcntl.fcntl(fd, fcntl.F_GETFD)
513+
self.assertFalse(flags & fcntl.FD_CLOEXEC)
514+
508515

509516
class TestBaseAIO(_TestBase, AIOTestCase):
510517
pass

0 commit comments

Comments
 (0)