|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
).then(()=>{ |
|
|
).then(()=>{ |
|
|
// runas returned. |
|
|
// runas returned. |
|
|
var runaslog = JSON.parse('[ { "success" : true, "result" : "runas Log" }' + fs.readFileSync('run.log', { flags : 'a+'}) + ']'); |
|
|
|
|
|
runaslog.forEach((logEntry)=>{ |
|
|
|
|
|
logEntry.success ? (console.log(['success :' + logEntry.result]), console.log((logEntry.messages || []).join(' '))) : console.error(['error :' + logEntry.result]), console.error((logEntry.messages || []).join(' ')) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
var runaslog = JSON.parse('[ { "success" : true, "result" : "runas Log" }' + fs.readFileSync('run.log', { flags : 'a+'}) + ']'); |
|
|
|
|
|
runaslog.forEach((logEntry)=>{ |
|
|
|
|
|
logEntry.success ? (console.log(['success :' + logEntry.result]), console.log((logEntry.messages || []).join(' '))) : (console.error(['error :' + logEntry.result]), console.error((logEntry.messages || []).join(' '))) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
catch(e){ |
|
|
|
|
|
// Ignore nonexistent log |
|
|
|
|
|
console.warn('Run log error probably was not created by runas : ' + e) |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
.catch(err => console.error('Elevation failed : ' + err)); |
|
|
.catch(err => console.error('Elevation failed : ' + err)); |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
var performCheckout = (repo)=>{ |
|
|
var performCheckout = (repo)=>{ |
|
|
if(excludeCheckouts[repo]) return Promise.resolve({ 'skipped' : true }) |
|
|
if(excludeCheckouts[repo]) return Promise.resolve({ 'skipped' : true }) |
|
|
return nodeShellExec('git', ['switch', '-m', '-C', checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV], { |
|
|
return nodeShellExec('git', ['switch', '-m', '-C', checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV], { |
|
|
inherit : true, shell: true, |
|
|
|
|
|
|
|
|
// inherit : true, shell: true, |
|
|
cwd : repo |
|
|
cwd : repo |
|
|
|
|
|
// , stdio : ignore // Use when we want to silcence output completely. |
|
|
, runas : processedArgs.runas |
|
|
, runas : processedArgs.runas |
|
|
, title : `git switch -C -m ${checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV} for ${repo}` |
|
|
, title : `git switch -C -m ${checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV} for ${repo}` |
|
|
}).catch((e)=>{ console.error(e); return { error : true, message : repo} }) |
|
|
}).catch((e)=>{ console.error(e); return { error : true, message : repo} }) |
|
|
|
|
|
|
|
|
var performPullAll = (repo)=>{ |
|
|
var performPullAll = (repo)=>{ |
|
|
if(excludeCheckouts[repo]) return Promise.resolve({ 'skipped' : true }) |
|
|
if(excludeCheckouts[repo]) return Promise.resolve({ 'skipped' : true }) |
|
|
return nodeShellExec('git', ['pull', '--all'], { |
|
|
return nodeShellExec('git', ['pull', '--all'], { |
|
|
inherit : true, shell: true, |
|
|
|
|
|
|
|
|
// inherit : true, shell: true, |
|
|
cwd : repo |
|
|
cwd : repo |
|
|
, runas : processedArgs.runas |
|
|
, runas : processedArgs.runas |
|
|
, title : `git switch -C -m ${checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV} for ${repo}` |
|
|
|
|
|
|
|
|
, title : `git pull -all for ${checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV} ${repo}` |
|
|
}).catch((e)=>{ console.error(e); return { error : true, message : repo} }) |
|
|
}).catch((e)=>{ console.error(e); return { error : true, message : repo} }) |
|
|
} |
|
|
} |
|
|
|
|
|
|