Process call fails when issued from Robot Framework

I’ve noticed following behavior:

    os.dup2(tee.stdin.fileno(), sys.stdout.fileno())
    os.dup2(tee.stdin.fileno(), sys.stderr.fileno())

Works fine when directly executed via python, but when command is issued via robot framework subprocess starts to yield an error:
XX.robot`

Traceback (most recent call last):
File “/usr/lib/python3.8/threading.py”, line 932, in _bootstrap_inner
self.run()
File “/home/tmp/Trace/TracieThread.py”, line 33, in run
os.dup2(tee.stdin.fileno(), sys.stdout.fileno())
io.UnsupportedOperation: fileno

Robot intercepts sys.stdout and sys.stderr so that they are replaced with StringIO objects. If you need to access original streams, use sys.__stdout__ and sys.__stderr__.

It works. Thank you.