Browse Source

Fixed elevated runs

master
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

@@ -2868,6 +2868,7 @@ var elxr = {

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

if(def.elevated){
elevatedpulltasks = function() {
var eBatch = []
@@ -2895,7 +2896,13 @@ var elxr = {
}
// if(elevatedpulltasks) return getTaskWithElevation( { elevatedpulltasks, 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()
})
})
}
}

@@ -4639,7 +4646,7 @@ function generateDependencies(){
// alert(objENV('wd'))
// PB : TODO -- Convert all the cli args back to string.
// __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');
// alert('launching node privilged. ' + processedArgs['nodepath'])
// shell.ShellExecute('cmd.exe', '/k where node', '', '', 10);

+ 2
- 2
win_verse.js View File

@@ -25,12 +25,12 @@ var shell_verse = {
var __runasresult = null;
return taskToRun().then((r)=>{
// 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.
return __runasresult = r;
})
.catch((e) => {
elevatedRunIPCWriteMessage( runlogjson, ', ' + JSON.stringify(e ) )
elevatedRunIPCWriteMessage( runlogjson, e )
if(!inBatch)fs.writeFileSync('run.done', 'failure')
console.error(e)
})

Loading…
Cancel
Save