chopsticks
chopsticks copied to clipboard
Tunnel destructor prevents subsequent stderr interception
When the Tunnel.close()
is called, the ioloop writer and reader instances are closed and oddly this makes subsequent stderr writes not intercepted by the orchestrator.
Eg:
# -*- coding: utf-8 -*-
import time
from chopsticks.tunnel import Local
def func():
import __bubble__
__bubble__.debug("Hi there!")
time.sleep(1) # Wait stderr to be flushed
for i in range(3):
print("Call #%s" % i)
m = Local() # triggers __del__ in cpython starting 2nd iteration
m.call(func)
outputs the following:
$ python3 test.py server
Call #0
[localhost] Hi there!
Call #1
Call #2
...no second output...
Please note that the comment
m = Local() # triggers __del__ in cpython starting 2nd iteration
comes from a test I originally made outside of a loop. Anyway you get the idea.