Browse Source

Fixed elevated runs

pull/9/head
pb 2 years ago
parent
commit
3cc9796222
2 changed files with 11 additions and 4 deletions
  1. 9
    2
      index.js
  2. 2
    2
      win_verse.js

+ 9
- 2
index.js View File



var regularpulltasks = function(){ return Promise.resolve(true) } var regularpulltasks = function(){ return Promise.resolve(true) }

if(def.elevated){ if(def.elevated){
elevatedpulltasks = function() { elevatedpulltasks = function() {
var eBatch = [] var eBatch = []
} }
// if(elevatedpulltasks) return getTaskWithElevation( { elevatedpulltasks, regularpulltasks} ) // if(elevatedpulltasks) return getTaskWithElevation( { elevatedpulltasks, regularpulltasks} )
// else return getTaskWithoutElevation({ regularpulltasks}) // else return getTaskWithoutElevation({ regularpulltasks})
return any([ elevatedpulltasks, regularpulltasks ])
return elevatedpulltasks().then(()=>{
return shell_verse.isElevated().then((__isRunningElevated)=>{
if(isWin() && __isRunningElevated) return Promise.resolve(true);

return regularpulltasks()
})
})
} }
} }


// alert(objENV('wd')) // alert(objENV('wd'))
// PB : TODO -- Convert all the cli args back to string. // PB : TODO -- Convert all the cli args back to string.
// __filename will sure we are launhed using the same entry point. // __filename will sure we are launhed using the same entry point.
var cargs = (processedArgs.debug ? '--inspect-brk=9228' : '') + ' ${__filename.replace(/\\/g, '\\\\')} ' + processedArgs._.join(' ') + ' ' + namedArgs.join(' ');
var cargs = (processedArgs.debug ? '--inspect-brk=9226' : '') + ' ${__filename.replace(/\\/g, '\\\\')} ' + processedArgs._.join(' ') + ' ' + namedArgs.join(' ');
var shell = new ActiveXObject('shell.application'); var shell = new ActiveXObject('shell.application');
// alert('launching node privilged. ' + processedArgs['nodepath']) // alert('launching node privilged. ' + processedArgs['nodepath'])
// shell.ShellExecute('cmd.exe', '/k where node', '', '', 10); // shell.ShellExecute('cmd.exe', '/k where node', '', '', 10);

+ 2
- 2
win_verse.js View File

var __runasresult = null; var __runasresult = null;
return taskToRun().then((r)=>{ return taskToRun().then((r)=>{
// PB : TODO -- Every elevation should have its own messaging file. Async writes from multiple processes are a problem here... // PB : TODO -- Every elevation should have its own messaging file. Async writes from multiple processes are a problem here...
elevatedRunIPCWriteMessage( runlogjson, ', ' + JSON.stringify( { info : taskToRun.info, success: true }) )
elevatedRunIPCWriteMessage( runlogjson, { info : taskToRun.info, success: true } )
if(!inBatch) fs.writeFileSync('run.done', 'success') // PB : TODO -- This should be done conditionally if we are running inproc. if(!inBatch) fs.writeFileSync('run.done', 'success') // PB : TODO -- This should be done conditionally if we are running inproc.
return __runasresult = r; return __runasresult = r;
}) })
.catch((e) => { .catch((e) => {
elevatedRunIPCWriteMessage( runlogjson, ', ' + JSON.stringify(e ) )
elevatedRunIPCWriteMessage( runlogjson, e )
if(!inBatch)fs.writeFileSync('run.done', 'failure') if(!inBatch)fs.writeFileSync('run.done', 'failure')
console.error(e) console.error(e)
}) })

Loading…
Cancel
Save