I have a script.sh which I start in Xvfb new session this way:Xvfb :10 -screen 0 1000x200x24 & export DISPLAY=:10 && script.shIn script.sh I run one c++ program and one java program. However, I sometimes got errors in one or two of them: in c++ program I got Segmentation fault and java program I got exception something like awt can't get display:10. The errors disappeared when I added in the beginning of script.sh the linesleep 2;After that I didn't get any errors. How to explain it?
Xvfb: is some delay required running some program in new session?
linux;bash;xorg;x server;xvfb
This question is similar to How to launch Xephyr without sleep-ing.Your applications try to access Xvfb before it is ready. The cleanest way to solve this is to use xinit.Run Xvfb withxinit script.sh -- /usr/bin/Xvfb :10(include export DISPLAY=:10 into script.sh)