Guest User

Untitled

a guest
Dec 8th, 2015
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Executor = {
  2.     //this.program = "";
  3.     //this.args = [];  
  4.        
  5.     constructor(options) {
  6.         this.program = options.program;
  7.        
  8.         console.log(options);
  9.         console.log(this.Object.keys());
  10.        
  11.         for(var o in options) {
  12.             if(this.Object.keys.indexOf(o) === -1) {
  13.                 this.args.push(options[o]);
  14.             }
  15.         }      
  16.     },
  17.    
  18.     successAction: function(data)
  19.     {
  20.         console.log(data);
  21.     },
  22.    
  23.     errorAction: function(err) {
  24.         console.log(err);
  25.     },
  26.    
  27.     execute: function() {
  28.         var command = this.program + ' ' + this.args.join(' ');
  29.         console.log("Execution => " + command);
  30.         exec(command, function(err, data) {
  31.             if(err != null) {
  32.                 this.errorAction(err);
  33.             } else {
  34.                 this.successAction(data);
  35.             }
  36.         });
  37.     }
  38.     //this.execute();
  39. }
Advertisement
Add Comment
Please, Sign In to add comment