mirror of
https://github.com/SELinuxProject/selinux
synced 2025-01-27 07:43:24 +00:00
sandbox: tests - close stdout of p1
p1.stdout should be closed after it's connected to p2 according to https://docs.python.org/3/library/subprocess.html#replacing-shell-pipeline Fixes: $ make PYTHON=python3 test Verify that we can read file descriptors handed to sandbox ... /usr/lib64/python3.5/unittest/case.py:638: ResourceWarning: unclosed file <_io.BufferedReader name=4> testMethod() Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
This commit is contained in:
parent
3aedecefc7
commit
6fcef9a09c
@ -28,6 +28,7 @@ class SandboxTests(unittest.TestCase):
|
||||
"Verify that we can read file descriptors handed to sandbox"
|
||||
p1 = Popen(['cat', '/etc/passwd'], stdout=PIPE)
|
||||
p2 = Popen([sys.executable, 'sandbox', 'grep', 'root'], stdin=p1.stdout, stdout=PIPE)
|
||||
p1.stdout.close()
|
||||
out, err = p2.communicate()
|
||||
self.assertTrue(b'root' in out)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user