Skip to content

Commit 8aa8806

Browse files
committed
Do not write to stdout in Electron when running on win32 CI machine
This makes Electron crash on CI machine somehow.
1 parent 6756f8c commit 8aa8806

3 files changed

Lines changed: 22 additions & 9 deletions

File tree

script/cibuild

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def main():
3939
if os.environ.has_key('TARGET_ARCH'):
4040
target_arch = os.environ['TARGET_ARCH']
4141

42-
is_appveyor = (os.getenv('APPVEYOR') == 'True')
4342
is_travis = (os.getenv('TRAVIS') == 'true')
4443
if is_travis and PLATFORM == 'linux':
4544
print 'Setup travis CI'
@@ -76,8 +75,10 @@ def main():
7675
run_script('create-dist.py')
7776
run_script('upload.py')
7877
else:
78+
if PLATFORM == 'win32':
79+
os.environ['OUTPUT_TO_FILE'] = 'output.log'
7980
run_script('build.py', ['-c', 'D'])
80-
if not is_appveyor and target_arch == 'x64':
81+
if target_arch == 'x64':
8182
run_script('test.py', ['--ci'])
8283

8384

script/test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ def main():
3232

3333
subprocess.check_call([atom_shell, 'spec'] + sys.argv[1:])
3434

35+
if os.environ.has_key('OUTPUT_TO_FILE'):
36+
output_to_file = os.environ['OUTPUT_TO_FILE']
37+
with open(output_to_file, 'r') as f:
38+
print f.read()
39+
3540

3641
if __name__ == '__main__':
3742
sys.exit(main())

spec/static/main.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ const ipcMain = electron.ipcMain
77
const dialog = electron.dialog
88
const BrowserWindow = electron.BrowserWindow
99

10+
const fs = require('fs')
1011
const path = require('path')
1112
const url = require('url')
13+
const util = require('util')
1214

1315
var argv = require('yargs')
1416
.boolean('ci')
@@ -35,13 +37,18 @@ ipcMain.on('message', function (event, arg) {
3537
event.sender.send('message', arg)
3638
})
3739

38-
ipcMain.on('console.log', function (event, args) {
39-
console.error.apply(console, args)
40-
})
41-
42-
ipcMain.on('console.error', function (event, args) {
43-
console.error.apply(console, args)
44-
})
40+
// Write output to file if OUTPUT_TO_FILE is defined.
41+
const outputToFile = process.env.OUTPUT_TO_FILE
42+
const print = function (_, args) {
43+
let output = util.format.apply(null, args)
44+
if (outputToFile) {
45+
fs.appendFileSync(outputToFile, output + '\n')
46+
} else {
47+
console.error(output)
48+
}
49+
}
50+
ipcMain.on('console.log', print)
51+
ipcMain.on('console.error', print)
4552

4653
ipcMain.on('process.exit', function (event, code) {
4754
process.exit(code)

0 commit comments

Comments
 (0)