import { app } from "electron"; const gotLock = app.requestSingleInstanceLock(); const smoke = process.argv.includes("--smoke") || process.env.DEMO_SMOKE === "1"; if (!gotLock) { console.log( JSON.stringify({ evt: "smoke", ok: false, singleInstance: false }), ); app.quit(); } else { app.on("second-instance", (_event, argv) => { console.log( JSON.stringify({ evt: "second-instance", argv: argv.slice(1) }), ); }); app.whenReady().then(() => { if (smoke) { console.log( JSON.stringify({ evt: "smoke", ok: true, singleInstance: true }), ); app.quit(); } else { console.log( JSON.stringify({ evt: "ready", singleInstance: true, argv: process.argv.slice(1), }), ); } }); }