Skip to content

Visual Studio Code, rebuilt in Rust

Rust

fix(linux): start the smoke run once Xvfb accepts clients

rokartur1bb1569cc41a
diff --git a/port/tools/linux/smoke b/port/tools/linux/smoke
index 213ec9407c9..ebb8065996a 100755
--- a/port/tools/linux/smoke
+++ b/port/tools/linux/smoke
@@ -12,8 +12,11 @@ if [[ -z ${APP:-} ]]; then
fi
dir=$(mktemp -d)
trap 'kill %1; rm -rf "$dir"' EXIT
-Xvfb :99 -screen 0 1600x1000x24 >/dev/null 2>&1 &
-export DISPLAY=:99
+# -displayfd picks a free display and writes its number once Xvfb accepts clients; the app exits with
+# "Failed to initialize X11 client" when it starts before that.
+Xvfb -displayfd 1 -screen 0 1600x1000x24 >"$dir/display" 2>/dev/null &
+for _ in $(seq 100); do [ -s "$dir/display" ] && break; sleep 0.1; done
+export DISPLAY=:$(cat "$dir/display")
cp -R port/fixtures/workspace "$dir/workspace"
git -C "$dir/workspace" init -q && git -C "$dir/workspace" add -A && git -C "$dir/workspace" -c user.name=smoke -c user.email=smoke@localhost commit -qm fixture