3

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

john
  • 87
  • 1
  • 5
  • Does this answer your question? [How to redirect stderr and stdout to different files in the same line in script?](https://stackoverflow.com/questions/7901517/how-to-redirect-stderr-and-stdout-to-different-files-in-the-same-line-in-script) – Seon Sep 02 '21 at 08:34
  • Thank you for your suggestion, unfortunately this is not what I have problems with. The problem is that the program xfb-run will write its stdout to `out` and its stderr to `err`. And it seems to take the stdout and stderr of the command it is executed on an puts it together into its own stdoud. So I only see two options either there is some arguments I could pass to xfvb-run that I am not aware that leaves stdout and stderr sperated or ther is some bash magic I am not aware of. – john Sep 03 '21 at 10:03

1 Answers1

3

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.

Roman S
  • 31
  • 4
  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/30676036) – l33tHax0r Dec 27 '21 at 16:53