Do not write to stdout in Electron when running on win32 CI machine
This makes Electron crash on CI machine somehow.
This commit is contained in:
parent
6756f8c7af
commit
8aa88067ca
3 changed files with 22 additions and 9 deletions
|
@ -7,8 +7,10 @@ const ipcMain = electron.ipcMain
|
|||
const dialog = electron.dialog
|
||||
const BrowserWindow = electron.BrowserWindow
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const url = require('url')
|
||||
const util = require('util')
|
||||
|
||||
var argv = require('yargs')
|
||||
.boolean('ci')
|
||||
|
@ -35,13 +37,18 @@ ipcMain.on('message', function (event, arg) {
|
|||
event.sender.send('message', arg)
|
||||
})
|
||||
|
||||
ipcMain.on('console.log', function (event, args) {
|
||||
console.error.apply(console, args)
|
||||
})
|
||||
|
||||
ipcMain.on('console.error', function (event, args) {
|
||||
console.error.apply(console, args)
|
||||
})
|
||||
// Write output to file if OUTPUT_TO_FILE is defined.
|
||||
const outputToFile = process.env.OUTPUT_TO_FILE
|
||||
const print = function (_, args) {
|
||||
let output = util.format.apply(null, args)
|
||||
if (outputToFile) {
|
||||
fs.appendFileSync(outputToFile, output + '\n')
|
||||
} else {
|
||||
console.error(output)
|
||||
}
|
||||
}
|
||||
ipcMain.on('console.log', print)
|
||||
ipcMain.on('console.error', print)
|
||||
|
||||
ipcMain.on('process.exit', function (event, code) {
|
||||
process.exit(code)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue