pi-ext
bugabingas pi extensions
owned by bugabinga
test(system): write browser arguments atomically
519918352b55e49fb7f48ebbcc0f88003a1d4b7c
Oliver Krylow <o.krylow@isp-insoft.de> ·
SSH signature · not checked
Browse filesCompare with HEAD
Changed files (1)
extensions/the-system/__tests__/open-browser.test.ts
Modified+2 / −1 text lines
2727 const executable = path.join(root, "rundll32.exe"); const executable = path.join(root, "rundll32.exe"); 2828 const preload = path.join(root, "record.cjs"); const preload = path.join(root, "record.cjs"); 2929 const record = path.join(root, "args.json"); const record = path.join(root, "args.json"); 30+ const temporaryRecord = path.join(root, "args.json.tmp"); 3031 const html = path.join(root, "system.html"); const html = path.join(root, "system.html"); 3132 copyFileSync(process.execPath, executable); copyFileSync(process.execPath, executable); 3233 chmodSync(executable, 0o755); chmodSync(executable, 0o755); 3334 writeFileSync( writeFileSync( 35- `require("node:fs").writeFileSync(${JSON.stringify(record)}, JSON.stringify(process.argv.slice(1)));`, 36+ `const fs = require("node:fs"); fs.writeFileSync(${JSON.stringify(temporaryRecord)}, JSON.stringify(process.argv.slice(1))); fs.renameSync(${JSON.stringify(temporaryRecord)}, ${JSON.stringify(record)});`, 3738 writeFileSync(html, "<!doctype html><title>System</title>"); writeFileSync(html, "<!doctype html><title>System</title>"); 3839 const opened = await openHtmlFile(html, { const opened = await openHtmlFile(html, {