On the NVIDIA proprietary driver the app booted, logged "miniSCP started", reported no error — and painted a completely black window, with stderr showing "Failed to create GBM buffer of size WxH: Invalid argument" and an X11 GLXBadWindow. WebKitGTK's DMABUF renderer cannot allocate buffers there; WEBKIT_DISABLE_DMABUF_RENDERER=1 is the upstream workaround. Pre-existing on Linux, unrelated to the context-menu change — it just had never been looked at because nothing on Linux had been run before. The app CANNOT apply this to itself. WebKit reads the variable when it forks its web process, and Bun's `process.env` writes do not propagate to child processes (verified: a spawned child sees it unset), so setting it in src/bun/index.ts is inert even from a module imported before `electrobun/bun`. It has to be in the environment before the app process starts, which means every launch path must inject it: - scripts/linux-gpu.ts — shared `launchEnv()` helper, gated on /proc/driver/nvidia so Intel/AMD keep hardware compositing, and never overriding an explicit value from the user's environment. - scripts/dev.ts — uses it for `bun run dev`. - scripts/start.ts (new) — `bun run start` previously called `bunx electrobun dev` straight from package.json, where no env could be set; it now goes through a script like dev does. - scripts/release.ts — writes a `miniSCP.sh` wrapper beside bin/launcher in the Linux tarball, since a packaged app goes through none of the above. Documented in gotchas.md (including that a "does it boot?" log check does NOT catch this — the log looks healthy) and platform-notes.md, with the smoke test updated to require that the UI actually renders. Verified: backend `tsc --noEmit` clean, `bun run build:ui` clean, and `bun run start` now boots with zero GBM/GLX errors. Co-Authored-By: Claude <noreply@anthropic.com>
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
// Dev orchestrator: starts ng serve (UI hot reload), waits for it, then runs
|
|
// `electrobun dev --watch` (relaunches the app when bun-side code changes).
|
|
import { launchEnv } from "./linux-gpu";
|
|
|
|
const DEV_SERVER_URL = "http://localhost:4200";
|
|
|
|
const ui = Bun.spawn(["bun", "run", "--cwd", "ui", "start"], {
|
|
stdout: "inherit",
|
|
stderr: "inherit",
|
|
});
|
|
|
|
async function waitForServer(url: string, timeoutMs = 90_000): Promise<void> {
|
|
const deadline = Date.now() + timeoutMs;
|
|
while (Date.now() < deadline) {
|
|
try {
|
|
await fetch(url, { method: "HEAD" });
|
|
return;
|
|
} catch {
|
|
await Bun.sleep(300);
|
|
}
|
|
}
|
|
throw new Error(`Dev server at ${url} did not come up in ${timeoutMs}ms`);
|
|
}
|
|
|
|
console.log(`Waiting for Angular dev server at ${DEV_SERVER_URL} ...`);
|
|
await waitForServer(DEV_SERVER_URL);
|
|
console.log("Angular dev server is up, launching Electrobun ...");
|
|
|
|
const app = Bun.spawn(["bunx", "electrobun", "dev", "--watch"], {
|
|
stdout: "inherit",
|
|
stderr: "inherit",
|
|
env: launchEnv({ DEV_SERVER_URL }),
|
|
});
|
|
|
|
function shutdown() {
|
|
ui.kill();
|
|
app.kill();
|
|
process.exit(0);
|
|
}
|
|
process.on("SIGINT", shutdown);
|
|
process.on("SIGTERM", shutdown);
|
|
|
|
await app.exited;
|
|
shutdown();
|