Send messages between app via socket connection
This commit is contained in:
parent
628744f9e1
commit
523fbe2df9
2 changed files with 61 additions and 17 deletions
10
spec/fixtures/api/mixed-sandbox-app/main.js
vendored
10
spec/fixtures/api/mixed-sandbox-app/main.js
vendored
|
@ -1,4 +1,5 @@
|
|||
const {app, BrowserWindow, ipcMain} = require('electron')
|
||||
const net = require('net')
|
||||
const path = require('path')
|
||||
|
||||
process.on('uncaughtException', () => {
|
||||
|
@ -44,7 +45,14 @@ app.once('ready', () => {
|
|||
}
|
||||
|
||||
if (argv.sandbox != null && argv.noSandbox != null) {
|
||||
process.send(argv)
|
||||
const socketPath = process.platform === 'win32' ? '\\\\.\\pipe\\electron-mixed-sandbox' : '/tmp/electron-mixed-sandbox'
|
||||
const client = net.connect(socketPath)
|
||||
client.once('connect', () => {
|
||||
client.end(JSON.stringify(argv))
|
||||
})
|
||||
client.once('end', () => {
|
||||
app.exit(0)
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue