зеркало из https://github.com/electron/electron.git
spec: It is not certain which process starts first
This commit is contained in:
Родитель
5940231b76
Коммит
d87ea5713d
|
@ -162,23 +162,18 @@ describe('app module', function () {
|
|||
this.timeout(120000)
|
||||
const appPath = path.join(__dirname, 'fixtures', 'api', 'singleton')
|
||||
// First launch should exit with 0.
|
||||
let exited = 0
|
||||
const first = ChildProcess.spawn(remote.process.execPath, [appPath])
|
||||
first.once('exit', (code) => {
|
||||
assert.equal(code, 0)
|
||||
exited++
|
||||
if (exited === 2) {
|
||||
done()
|
||||
}
|
||||
})
|
||||
// Second launch should exit with 1.
|
||||
const second = ChildProcess.spawn(remote.process.execPath, [appPath])
|
||||
second.once('exit', (code) => {
|
||||
assert.equal(code, 1)
|
||||
exited++
|
||||
if (exited === 2) {
|
||||
// Start second app when received output.
|
||||
first.stdout.once('data', () => {
|
||||
// Second launch should exit with 1.
|
||||
const second = ChildProcess.spawn(remote.process.execPath, [appPath])
|
||||
second.once('exit', (code) => {
|
||||
assert.equal(code, 1)
|
||||
done()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
const {app} = require('electron')
|
||||
|
||||
process.on('uncaughtException', () => {
|
||||
app.exit(2)
|
||||
})
|
||||
console.log('started') // ping parent
|
||||
|
||||
const shouldExit = app.makeSingleInstance(() => {
|
||||
process.nextTick(() => app.exit(0))
|
||||
|
|
Загрузка…
Ссылка в новой задаче