stop leaking file descriptors
tripps --lsof on os x but not on linux. there's possibly a bug in the leak detector (not investigated here) --HG-- branch : stop_leaking_fds
This commit is contained in:
parent
e4fde1048b
commit
35eec99d41
|
@ -744,6 +744,7 @@ class TestFDCapture:
|
||||||
cap.done()
|
cap.done()
|
||||||
pytest.raises(AttributeError, cap.suspend)
|
pytest.raises(AttributeError, cap.suspend)
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def saved_fd(fd):
|
def saved_fd(fd):
|
||||||
new_fd = os.dup(fd)
|
new_fd = os.dup(fd)
|
||||||
|
@ -751,6 +752,7 @@ def saved_fd(fd):
|
||||||
yield
|
yield
|
||||||
finally:
|
finally:
|
||||||
os.dup2(new_fd, fd)
|
os.dup2(new_fd, fd)
|
||||||
|
os.close(new_fd)
|
||||||
|
|
||||||
|
|
||||||
class TestStdCapture:
|
class TestStdCapture:
|
||||||
|
|
Loading…
Reference in New Issue