#Instructions:
npm install
npm start
node_modules | |
downloads | |
crashes |
const cp = require('child_process'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const request = require('request'); | |
const unzipper = require('unzipper'); | |
const electronVersion = '11.4.5'; | |
const electronArch = 'win32-ia32'; | |
const downloadDir = path.join(__dirname, 'downloads', `${electronVersion}-${electronArch}`) | |
const electronDir = path.join(downloadDir, 'electron'); | |
const electronExe = path.join(electronDir, 'electron.exe'); | |
const mainScript = path.join(__dirname, 'main.js'); | |
const symbolsDir = path.join(downloadDir, 'breakpad_symbols'); | |
function ensureElectron() { | |
if (fs.existsSync(electronExe)) { | |
return downloadSymbols(); | |
} | |
const electron_url = `https://github.com/electron/electron/releases/download/v${electronVersion}/electron-v${electronVersion}-${electronArch}.zip`; | |
console.log("downloading electron..."); | |
request(electron_url).pipe(unzipper.Extract({ path: electronDir })).on("close", downloadSymbols); | |
} | |
function downloadSymbols() { | |
if (fs.existsSync(symbolsDir)) { | |
return runElectron(); | |
} | |
const symbols_url = `https://github.com/electron/electron/releases/download/v${electronVersion}/electron-v${electronVersion}-${electronArch}-symbols.zip`; | |
console.log("downloading symbols..."); | |
request(symbols_url).pipe(unzipper.Extract({ path: downloadDir })).on("close", runElectron); | |
} | |
function runElectron() { | |
console.log("running electron"); | |
cp.execSync(`${electronExe} ${mainScript}`, { cwd: __dirname }); | |
} | |
ensureElectron(); |
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Electron 10+ crash on windows 32-bit</title> | |
</head> | |
<body> | |
<h1>Electron 10+ crash on windows 32-bit</h1> | |
<script> | |
setTimeout(() => { | |
alert("will trigger renderer crash now"); | |
try { | |
function run() { | |
run(); | |
}; | |
run(); | |
} catch (e) { | |
console.error(e); | |
} | |
}, 2000); | |
</script> | |
</body> | |
</html> |
const path = require('path'); | |
const { app, dialog, BrowserWindow, crashReporter } = require('electron'); | |
const crashesDir = path.join(__dirname, 'crashes'); | |
app.setPath('crashDumps', crashesDir); | |
crashReporter.start({ submitURL: 'http://127.0.0.1' }); | |
function createWindow () { | |
const win = new BrowserWindow({ | |
width: 800, | |
height: 600 | |
}); | |
win.loadFile('index.html'); | |
win.webContents.on("render-process-gone", (_, details) => { | |
dialog.showMessageBoxSync({message: `renderer process crashed, the .dmp file is located in ${crashesDir}`}); | |
app.quit(); | |
}); | |
} | |
app.whenReady().then(() => { | |
createWindow(); | |
app.on('activate', () => { | |
if (BrowserWindow.getAllWindows().length === 0) { | |
createWindow(); | |
} | |
}); | |
}); | |
app.on('window-all-closed', () => { | |
if (process.platform !== 'darwin') { | |
app.quit(); | |
} | |
}); |
{ | |
"name": "electron-win32bit-crash", | |
"version": "1.0.0", | |
"private": true, | |
"description": "", | |
"main": "main.js", | |
"dependencies": {}, | |
"devDependencies": { | |
"request": "^2.88.2", | |
"unzipper": "^0.10.11" | |
}, | |
"scripts": { | |
"start": "node bootstrap-run.js" | |
}, | |
"author": "", | |
"license": "ISC" | |
} |