Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to redirect error output of command executed with xvfb-run

Tags:

python

I have a python script that I want to run with xfvb-run. The original command would like so:

script.py > out 2> err

now it looks like so:

xvfb-run -d script.py > out 2> err

Yet this puts the error messages from script.py into out and not into err. Which is understandable. Yet I would achieve the same behavior like before. How do I do this?

Thanks

like image 697
john Avatar asked Nov 25 '25 07:11

john


1 Answers

It seems to be a bug in xvfb that was reported in 2014 and there seems to be no intention in fixing it. https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/1059947 As suggested here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=868876 You can make the following change in line 180:

-DISPLAY=:$SERVERNUM XAUTHORITY=$AUTHFILE "$@" 2>&1

+DISPLAY=:$SERVERNUM XAUTHORITY=$AUTHFILE "$@"

This is an ugly patch but solves the issue.

like image 68
Roman S Avatar answered Nov 26 '25 22:11

Roman S



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!