| 
				
			 | 
			
			 | 
			@@ -13,33 +13,38 @@ var shell_verse = { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    else return shell_verse.runNonElevated( taskToRun ) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  , elevatedRunner( taskToRun ){ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  , elevatedRunner( taskToRun, inBatch ){ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    // PB : TODO -- Should be called only when we are in an elevated shell that was already requested from an unelevated shell with a batch of tasks. | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    try { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      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... | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			          fs.writeFileSync('run.log', ', ' + JSON.stringify( { info : taskToRun.info, success: true }), { 'flag': 'a+' }) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			          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; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        }) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        .catch((e) => { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			          fs.writeFileSync('run.log', ', ' + JSON.stringify(e), { 'flag': 'a+' }) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			          fs.writeFileSync('run.done', 'failure') | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			          if(!inBatch)fs.writeFileSync('run.done', 'failure') | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			          console.error(e) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        }) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        .finally(() => { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			          if(__runasresult && !__runasresult.skipped) fs.unlinkSync('run.done') | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			          // if(__runasresult && !__runasresult.skipped) fs.unlinkSync('run.done') | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        }) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    catch (e) { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      console.error('Error Invalid command : ' + e) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      fs.writeFileSync('run.done', 'error') | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      if(!inBatch) fs.writeFileSync('run.done', 'error') | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    finally { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  , getElevatedTask : function( taskToRun ){ return ()=>{ return shell_verse.runElevated(taskToRun) }} | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  , getElevatedTaskInBatch : function( taskToRun ){ return ()=>{ return shell_verse.runElevatedInBatch(taskToRun) }} | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  , runElevatedInBatch : ( taskToRun ) => { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    if (__isElevated) return shell_verse.elevatedRunner(taskToRun, true) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    else return shell_verse.requestElevation(shell_verse.elevatedRunner, taskToRun) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  , runElevated : ( taskToRun ) => { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    // Let shell_verse decide whether to Elevate Out of Proc or In Proc | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			     | 
		
		
	
	
		
			
			| 
				
			 | 
			
			 | 
			@@ -63,7 +68,20 @@ var shell_verse = { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    // In windows we don't need to run each task. We hand over to another shell which in elevated state rebuilds the whole batch and runs. | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    // Irrespective of the batch we just call runElevated once. | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    if (__isElevated) { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      return any(batchToRun); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      return any(batchToRun).then((r)=>{  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        // PB : TODO -- Every elevation should have its own messaging file. Async writes from multiple processes are a problem here... | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        // fs.writeFileSync('run.log', ', ' + JSON.stringify( { info : taskToRun.info, success: true }), { 'flag': 'a+' }) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        fs.writeFileSync('run.done', 'success')  // PB : TODO -- This should be done conditionally if we are running inproc. | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        return __runasresult = r; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      }) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      .catch((e) => { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        // fs.writeFileSync('run.log', ', ' + JSON.stringify(e), { 'flag': 'a+' }) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        fs.writeFileSync('run.done', 'failure') | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        console.error(e) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      }) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      // .finally(() => { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      //   if(__runasresult && !__runasresult.skipped) fs.unlinkSync('run.done') | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      // }); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    else { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      return this.runElevated(batchToRun[0]) |