Datasets:
Download ubuntu/marktext-marktext/reference/launch.sh from Qwen/RecreationBench: direct link, hf CLI and curl.
- Browser
- Download file 3.51 kB
-
https://huggingface.co/datasets/Qwen/RecreationBench/resolve/main/ubuntu/marktext-marktext/reference/launch.sh
- Command line
-
hf download hf://datasets/Qwen/RecreationBench/ubuntu/marktext-marktext/reference/launch.sh
-
curl -L -o launch.sh https://huggingface.co/datasets/Qwen/RecreationBench/resolve/main/ubuntu/marktext-marktext/reference/launch.sh
3.51 kB
| ############################################################################### | |
| # launch.sh — start the built MarkText app (Electron/Chromium). | |
| # | |
| # Standalone: does not require build.sh to have been sourced. It only depends | |
| # on the install tree produced by build.sh at /workspace/install/marktext. | |
| ############################################################################### | |
| set -euo pipefail | |
| APP_DIR="/workspace/install/marktext" | |
| DESKTOP="${APP_DIR}/packages/desktop" | |
| ELECTRON_BIN="${DESKTOP}/node_modules/electron/dist/electron" | |
| if [[ ! -x "${ELECTRON_BIN}" ]]; then | |
| echo "launch.sh: Electron binary not found at ${ELECTRON_BIN}" >&2 | |
| echo " Run /workspace/output/build.sh first." >&2 | |
| exit 1 | |
| fi | |
| # --- Display ----------------------------------------------------------------- | |
| # A display is already running and managed by the pipeline; use it as-is. | |
| export DISPLAY="${DISPLAY:-:0}" | |
| # --- Locale resolution ------------------------------------------------------- | |
| # The main process loads translations from <cwd>/static/locales/*.min.json when | |
| # PERF_TESTING=true (or NODE_ENV=development); otherwise it looks under | |
| # process.resourcesPath (only valid for an electron-builder package). We launch | |
| # the electron-vite build directly, so set PERF_TESTING and run with | |
| # cwd=packages/desktop where static/locales lives. | |
| export PERF_TESTING=true | |
| # --- Accessibility (AT-SPI) -------------------------------------------------- | |
| # This is a genuine Electron/Chromium app. Without --force-renderer-accessibility | |
| # Chromium exposes no AT-SPI tree (only a bare top-level window), which breaks | |
| # downstream accessibility testing. | |
| export ELECTRON_ENABLE_ACCESSIBILITY=1 | |
| # AT-SPI needs the app on the SHARED session bus. If one is already provided by | |
| # the pipeline, join it (do NOT wrap in a private dbus-run-session — that would | |
| # isolate the AT-SPI tree onto a bus the harness cannot see). Only fall back to | |
| # the well-known per-user socket if the variable is unset. | |
| if [[ -z "${DBUS_SESSION_BUS_ADDRESS:-}" ]]; then | |
| if [[ -S "/run/user/$(id -u)/bus" ]]; then | |
| export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u)/bus" | |
| fi | |
| fi | |
| # --- Per-launch user-data-dir ------------------------------------------------ | |
| # The harness relaunches the app once per test module; a shared/fixed | |
| # --user-data-dir triggers Chromium single-instance lock collisions so later | |
| # launches fail. Use a UNIQUE dir per launch and clean it up on exit. | |
| USER_DATA_DIR="$(mktemp -d /tmp/marktext-userdata-XXXXXX)" | |
| cleanup() { rm -rf "${USER_DATA_DIR}"; } | |
| trap cleanup EXIT | |
| cd "${DESKTOP}" | |
| # --- Launch ------------------------------------------------------------------ | |
| # * Pass the app directory (packages/desktop) as the entry so Electron reads | |
| # package.json -> main: ./out/main/index.js and getAppPath() is correct. | |
| # * --no-sandbox: required when running as root and in the sandboxed CI/VM env. | |
| # * --force-renderer-accessibility: expose the full AT-SPI tree (see above). | |
| # * GPU disabled + software rasterizer off: the headless VM has no usable GPU; | |
| # without this Chromium aborts with "GPU process isn't usable. Goodbye." | |
| # * exec + "$@": replace the shell so signals reach Electron, forwarding any | |
| # extra args (e.g. a file to open) the caller supplies. | |
| exec "${ELECTRON_BIN}" \ | |
| "${DESKTOP}" \ | |
| --no-sandbox \ | |
| --force-renderer-accessibility \ | |
| --disable-gpu \ | |
| --disable-gpu-compositing \ | |
| --disable-software-rasterizer \ | |
| --user-data-dir="${USER_DATA_DIR}" \ | |
| "$@" | |