I am using a node-powershell module from https://www.npmjs.com/package/node-powershell.
var shell = require('node-powershell');
PS = new shell('echo "node-powershell is awesome"');
PS.on('output', function(data){
console.log(data);
});
PS.on('end', function(code) {
//optional callback
//Do Something
});
I am trying to return data from a function and assign it to a variable $returneddata:
function getData()
{
var shell = require('node-powershell');
PS = new shell('echo "node-powershell is awesome"', {debugMsg: false});
PS.on('output', function(data){
return data;
});
PS.on('end', function(code) {
});
}
var $returneddata = getData();
But it does not assign it.