server: 2nd attempt to run server process as node, works in dev and prod
This commit is contained in:
parent
beaf2c5f40
commit
cb638507e3
1 changed files with 5 additions and 6 deletions
|
|
@ -21,11 +21,9 @@ if (settings.read('docs')) return openDocs()
|
|||
|
||||
function nodeMode() {
|
||||
|
||||
console.warn('(INFO) Running with node')
|
||||
|
||||
if (!settings.read('no-gui')) {
|
||||
settings.write('no-gui', true, true)
|
||||
console.warn('(INFO) Headless mode (--no-gui) enabled automatically')
|
||||
console.warn('(INFO) Headless mode (--no-gui) enabled automatically (running with node)')
|
||||
}
|
||||
|
||||
process.on('uncaughtException', (err)=>{
|
||||
|
|
@ -155,8 +153,9 @@ if (settings.cli) {
|
|||
|
||||
ipcMain.on('start',function(e, options){
|
||||
|
||||
var args = ['--no-gui']
|
||||
if (process.platform === 'win32') args.unshift('--')
|
||||
var args = ['--', app.getAppPath(), '--no-gui']
|
||||
|
||||
// if (process.platform === 'win32') args.unshift('--') // not needed with ELECTRON_RUN_AS_NODE since '--' is always prepended
|
||||
for (var k in settings.read('options')) {
|
||||
args.push('--' + k)
|
||||
var val = settings.read(k)
|
||||
|
|
@ -167,7 +166,7 @@ if (settings.cli) {
|
|||
}
|
||||
}
|
||||
|
||||
global.serverProcess = spawn(process.argv[0], process.argv.slice(1).concat(args), {stdio: 'pipe'/*, env: {"ELECTRON_RUN_AS_NODE":"1"}*/})
|
||||
global.serverProcess = spawn(process.argv[0], args, {stdio: 'pipe', env: {'ELECTRON_RUN_AS_NODE':'1'}})
|
||||
launcher.webContents.send('server-started')
|
||||
|
||||
if (!settings.read('no-gui')) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue