Browse Source

Accumulate process messages

production
Pradeep Bhaskaran 4 years ago
parent
commit
63f066d2a6
1 changed files with 15 additions and 10 deletions
  1. 15
    10
      index.js

+ 15
- 10
index.js View File

@@ -246,9 +246,10 @@ var __runcmd = function(label){
if(existsSync(clonable)) {
console.log('pulling ' + clonable)
nodeShellExec('git', ['pull'], {
inherit : true, shell: true
, cwd : clonable
, env: process.env
// inherit : true, shell: true
// ,
cwd : clonable
// , env: process.env
, title : `git pull ${clonable}`
}).catch((e)=>{ console.error(e) })
}
@@ -256,10 +257,11 @@ var __runcmd = function(label){
console.log('cloning ' + clonable)
nodeShellExec('git', ['clone', '//172.16.0.27/repos/' + clonable + '.git'],
{
inherit : true, shell: true
, cwd : clonable
, env: process.env
, title : `git pull ${clonable}`
// inherit : true, shell: true
// ,
cwd : clonable
// , env: process.env
, title : `git clone ${'//172.16.0.27/repos/' + clonable + '.git'}`
}).catch((e)=>{ console.error(e) })
}
})
@@ -325,6 +327,7 @@ var __runcmd = function(label){
// };
// nodeShellExec('git', ['init'], { inherit : true});
if(0){
// PB : TODO -- Special google chrome profile for tests etc.
nodeShellExec('pwd', { inherit : true});
//$ "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 1" http://localhost:4200/tests/index.html?grep=loopback
nodeShellExec("C:/Program Files (x86)/Google/Chrome/Application/chrome.exe", [
@@ -369,16 +372,18 @@ function nodeShellExec() {
const child = spawn(...arguments);

return new Promise(function(resolve, reject){

var messages = []; // PB : TODO -- Explore stream for Task level aggregation to prevent interleaved messages from multiple tasks...
// use child.stdout.setEncoding('utf8'); if you want text chunks
child.stdout.setEncoding('utf8');
child.stdout.on('data', (chunk) => console.log(chunk));
child.on('error', (chunk) => console.error(chunk));
child.stdout.on('data', (chunk) => { messages.push(chunk); /*console.log(chunk)*/});
child.on('error', (chunk) => { messages.push(chunk); /*console.error(chunk)*/ });
child.stderr.pipe(process.stderr);

child.on('close', (code) => {
console.log(` ${args[2].title} exited with code ${code}`)
console.log(messages)
if(code !== 0 ) return reject(code)
resolve(true)
});

Loading…
Cancel
Save