Browse Source

elxr use enhancements

master
Pradeep Bhaskaran 4 years ago
parent
commit
ff898d027a
1 changed files with 13 additions and 8 deletions
  1. 13
    8
      index.js

+ 13
- 8
index.js View File

, 'elxr' , 'elxr'
, 'ember-searchable-select' , 'ember-searchable-select'
, 'loopback-component-jsonapi' , 'loopback-component-jsonapi'
, 'elixir-config'
, 'elixir-config-development'
, 'cihsr-config' , 'cihsr-config'
, 'cihsr-data' , 'cihsr-data'
, 'elixir-data' , 'elixir-data'
}) })
} }
, 'runas' : ()=>{ , 'runas' : ()=>{
return isRunningElevated().then(
() => op[ processedArgs.label || processedArgs._[0] || 'h']()
)
return isRunningElevated().then(() => op[ processedArgs.label || processedArgs._[0] || 'h']() )
.catch(()=>{ .catch(()=>{
console.log('Not Elevated'); console.log('Not Elevated');
console.dir(processedArgs) 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 // inherit : true
// , shell: true // , shell: true
// cwd : process.env.pwd
// ,
env: process.env env: process.env
, title : `runas`
} }
); );
}) })
if(processedArgs._[1] && runconfig.use !== processedArgs._[1]) runconfig.use = processedArgs._[1]; if(processedArgs._[1] && runconfig.use !== processedArgs._[1]) runconfig.use = processedArgs._[1];
if(!runconfig.use) { throw 'unspecifed use not allowed. Please specify chess instance name.' } 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 = [ tasks = [
()=>{ ()=>{

Loading…
Cancel
Save