Ver código fonte

elxr use enhancements

master
Pradeep Bhaskaran 4 anos atrás
pai
commit
ff898d027a
1 arquivos alterados com 13 adições e 8 exclusões
  1. 13
    8
      index.js

+ 13
- 8
index.js Ver arquivo

@@ -128,7 +128,7 @@ var gitRepos = [
, 'elxr'
, 'ember-searchable-select'
, 'loopback-component-jsonapi'
, 'elixir-config'
, 'elixir-config-development'
, 'cihsr-config'
, 'cihsr-data'
, 'elixir-data'
@@ -235,19 +235,23 @@ var __runcmd = function(label){
})
}
, 'runas' : ()=>{
return isRunningElevated().then(
() => op[ processedArgs.label || processedArgs._[0] || 'h']()
)
return isRunningElevated().then(() => op[ processedArgs.label || processedArgs._[0] || 'h']() )
.catch(()=>{
console.log('Not Elevated');
console.dir(processedArgs)
console.log('Requesting Elevated Privileges for : ' + `--insptec-brk elxr ${processedArgs._[0]} ${processedArgs._[1]} --runas=true`)
nodeShellExec('MSHTA', [`javascript: var shell = new ActiveXObject('shell.application'); shell.ShellExecute('node', 'elxr ${processedArgs._[0]} ${processedArgs._[1]} --runas=true', '', 'runas', 1);close();`]
// PB : TODO -- Convert all the cli args back to string.
var namedArgs = [];
Object.keys(processedArgs).forEach((v)=>{ v!='_' ? namedArgs.push('--'+v+'='+processedArgs[v]) : null; })
var cargs = `${processedArgs.debug ? '--inspect-brk' : ''} --inspect-brk elxr ${processedArgs._.join(' ')} ${namedArgs.join(' ') } --runas=true`
console.log('Requesting Elevated Privileges for : ' + `node ${cargs}`)
// fs.writeFileSync('runas.js', `javascript: var shell = new ActiveXObject('shell.application'); shell.ShellExecute('node', '${cargs}', '', 'runas', 1);close();`)
nodeShellExec('MSHTA', [`javascript: var shell = new ActiveXObject('shell.application'); shell.ShellExecute('node', '${cargs}', '', 'runas', 1);close();`]
, {
// inherit : true
// , shell: true
// cwd : process.env.pwd
// ,
env: process.env
, title : `runas`
}
);
})
@@ -498,7 +502,8 @@ var __runcmd = function(label){
if(processedArgs._[1] && runconfig.use !== processedArgs._[1]) runconfig.use = processedArgs._[1];
if(!runconfig.use) { throw 'unspecifed use not allowed. Please specify chess instance name.' }

fs.writeFileSync('../run.js', 'module.exports = ' + JSON.stringify(runconfig))
// console.log(process.env.cwd)
fs.writeFileSync('./run.js', 'module.exports = ' + JSON.stringify(runconfig))
tasks = [
()=>{

Carregando…
Cancelar
Salvar