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:

Traceback (most recent call last):
File “/usr/lib/python3.8/”, line 932, in _bootstrap_inner
File “/home/tmp/Trace/”, 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.