|
|
@@ -1874,31 +1874,56 @@ var op = { |
|
|
|
function startFn( o ){ |
|
|
|
var cmd = [nodecmd, [`--inspect=${o.debugport}`, '--preserve-symlinks', o.script]] |
|
|
|
console.log(`Starting ${o.name}.`); |
|
|
|
var childPromise = nodeShellExec('cmd', ['/k', getCmdString(cmd) ], { |
|
|
|
// inherit : true, |
|
|
|
shell: true, |
|
|
|
detached: true, |
|
|
|
stdio: 'ignore', |
|
|
|
cwd: instanceroot + o.path |
|
|
|
, env: env |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
if(shell_verse.iswin()){ |
|
|
|
var __cmd = 'cmd' |
|
|
|
var a1 = '/k' |
|
|
|
} |
|
|
|
else if(shell_verse.islin()) { |
|
|
|
var __cmd = 'sh' |
|
|
|
var a1 = '-c' |
|
|
|
} |
|
|
|
|
|
|
|
if(o.cmd) { |
|
|
|
cmd = o.cmd |
|
|
|
var childPromise = nodeShellExec(...o.cmd, { |
|
|
|
// inherit : true, |
|
|
|
shell: true, |
|
|
|
detached: true, |
|
|
|
stdio: 'ignore', |
|
|
|
cwd: instanceroot + o.path |
|
|
|
, env: env |
|
|
|
}) |
|
|
|
} |
|
|
|
else { |
|
|
|
var childPromise = nodeShellExec(__cmd, [a1, getCmdString(cmd) ], { |
|
|
|
// inherit : true, |
|
|
|
shell: true, |
|
|
|
detached: true, |
|
|
|
stdio: 'ignore', |
|
|
|
cwd: instanceroot + o.path |
|
|
|
, env: env |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
var child = childPromise.process; |
|
|
|
var cpid = child.pid |
|
|
|
if (typeof child.pid !== 'undefined') { |
|
|
|
childPromise.then(()=>{ |
|
|
|
console.log(` *** started Elixir Loopback Server PID(${cpid}) : NODE_ENV=${clioverrides.node_env} ${cmd}`); |
|
|
|
fs.writeFileSync('.elixir-server.elixir.server.pid', '' + cpid) |
|
|
|
childPromise.then(()=>{ |
|
|
|
console.log(` *** started ${o.name} PID(${cpid}) ${cmd}`); |
|
|
|
fs.writeFileSync(o.pidstore, '' + cpid) |
|
|
|
}) |
|
|
|
.catch(e => console.errror(e) ) |
|
|
|
} |
|
|
|
.catch(e => console.error(e) ) |
|
|
|
} |
|
|
|
|
|
|
|
if(clioverrides.node_env === 'development') { |
|
|
|
env.DEBUG = 'loopback:connector:' + dbForLabel(label) |
|
|
|
|
|
|
|
startFn( { debugport : 9228, script : 'elixir/server.js', name : 'Elixir Loopback Server', path : '/' + 'elixir-server' } ) |
|
|
|
startFn( { debugport : 9227, script : 'bin/www', name : 'Express Server', path : '/' + 'chess-server-lib/server' } ) |
|
|
|
startFn( { debugport : 9228, script : 'elixir/server.js', name : 'Elixir Loopback Server', path : '/' + 'elixir-server' |
|
|
|
, pidstore : '.express.server.pid' |
|
|
|
} ) |
|
|
|
startFn( { debugport : 9227, script : 'bin/www', name : 'Express Server', path : '/' + 'chess-server-lib/server' |
|
|
|
, pidstore : '.elixir-server.elixir.server.pid' |
|
|
|
} ) |
|
|
|
|
|
|
|
// cmd = 'node'() |
|
|
|
|
|
|
@@ -1916,46 +1941,62 @@ var op = { |
|
|
|
// cwd : 'client/', |
|
|
|
// env: env |
|
|
|
// }) |
|
|
|
console.log('Starting Elixir Client Host.'); |
|
|
|
var cmd = ['ember', ['s']] |
|
|
|
var childPromise = nodeShellExec(...cmd, { |
|
|
|
// var childPromise = nodeShellExec('node', ['--inspect=9227', './node_modules/.bin/ember', 's'], { |
|
|
|
// PB : TODO -- ember debugging. |
|
|
|
// inherit : true, |
|
|
|
shell: true, |
|
|
|
detached: true, |
|
|
|
stdio: 'ignore', |
|
|
|
cwd: instanceroot + '/' + 'client' |
|
|
|
, env: env |
|
|
|
}) |
|
|
|
// .catch(e=>console.error(e)) |
|
|
|
startFn( { |
|
|
|
name : 'Elixir Ember Client', path : '/' + 'client' |
|
|
|
, cmd : ['node_modules/ember-cli/bin/ember', ['s']] |
|
|
|
, pidstore : '.client.server.pid' |
|
|
|
} ) |
|
|
|
|
|
|
|
child = childPromise.process; |
|
|
|
if (typeof child.pid !== 'undefined') { |
|
|
|
console.log(`started Elixir Client Host PID(${child.pid}) : NODE_ENV=${process.NODE_ENV} ${cmd}`); |
|
|
|
fs.writeFileSync('.client.server.pid', child.pid, { |
|
|
|
encoding: 'utf8' |
|
|
|
}) |
|
|
|
} |
|
|
|
// console.log('Starting Elixir Ember Client'); |
|
|
|
// var cmd = ['ember', ['s']] |
|
|
|
// var childPromise = nodeShellExec(...cmd, { |
|
|
|
// // var childPromise = nodeShellExec('node', ['--inspect=9227', './node_modules/.bin/ember', 's'], { |
|
|
|
// // PB : TODO -- ember debugging. |
|
|
|
// // inherit : true, |
|
|
|
// shell: true, |
|
|
|
// detached: true, |
|
|
|
// stdio: 'ignore', |
|
|
|
// cwd: instanceroot + '/' + 'client' |
|
|
|
// , env: env |
|
|
|
// }) |
|
|
|
// // .catch(e=>console.error(e)) |
|
|
|
|
|
|
|
// child = childPromise.process; |
|
|
|
// if (typeof child.pid !== 'undefined') { |
|
|
|
// console.log(`started Elixir Client Host PID(${child.pid}) : NODE_ENV=${process.NODE_ENV} ${cmd}`); |
|
|
|
// fs.writeFileSync('.client.server.pid', '' + child.pid, { |
|
|
|
// encoding: 'utf8' |
|
|
|
// }) |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
, 'stop': (label) => { |
|
|
|
const kill = require('tree-kill'); |
|
|
|
|
|
|
|
var serverPid = fs.readFileSync('.elixir-server.elixir.server.pid', { |
|
|
|
encoding: 'utf8' |
|
|
|
}) |
|
|
|
fs.unlinkSync('.elixir-server.elixir.server.pid') |
|
|
|
console.log(serverPid) |
|
|
|
kill(serverPid) |
|
|
|
try{ |
|
|
|
var serverPid = fs.readFileSync('.elixir-server.elixir.server.pid', { encoding: 'utf8'}) |
|
|
|
fs.unlinkSync('.elixir-server.elixir.server.pid') |
|
|
|
console.log(serverPid) |
|
|
|
kill(serverPid) |
|
|
|
} |
|
|
|
catch(e){ console.error(e) } |
|
|
|
|
|
|
|
serverPid = fs.readFileSync('.express.server.pid', { |
|
|
|
encoding: 'utf8' |
|
|
|
}) |
|
|
|
fs.unlinkSync('.express.server.pid') |
|
|
|
console.log(serverPid) |
|
|
|
kill(serverPid) |
|
|
|
try{ |
|
|
|
serverPid = fs.readFileSync('.express.server.pid', { encoding: 'utf8' }) |
|
|
|
fs.unlinkSync('.express.server.pid') |
|
|
|
console.log(serverPid) |
|
|
|
kill(serverPid) |
|
|
|
} |
|
|
|
catch(e){ console.error(e) } |
|
|
|
|
|
|
|
try{ |
|
|
|
serverPid = fs.readFileSync('.client.server.pid', { encoding: 'utf8' }) |
|
|
|
fs.unlinkSync('.client.server.pid') |
|
|
|
console.log(serverPid) |
|
|
|
kill(serverPid) |
|
|
|
} |
|
|
|
catch(e){ console.error(e) } |
|
|
|
} |
|
|
|
, 'model' : () => { |
|
|
|
var etask = ()=>{ |