How get return from child node on meteor?


#1

Hi, i’m trying to get return of node child process, know you tell me what I could forget?

var spawn = Meteor.npmRequire('child_process').spawn;
var phantomjs = Meteor.npmRequire('phantomjs');

function getsession(){
  command = spawn(phantomjs.path, ['assets/app/phantomjsstayupdate.js']);
  command.stdout.on('data',  function (data) {
        var contentpre = String(data);
       return contentpre;
  });
}

var wrappedGetsession = Meteor.wrapAsync(getsession);

Meteor.methods({
  activesession: function(options){
      this.unblock();
        var globalreturn = wrappedGetsession();
        console.log(globalreturn);
  }
});