How to store stdout from the child_process exec's callback function


#1

Hello,

erl_ver is always empty outside the callback function. Inside the callback, erl_ver holds the correct value.
How can I store the value of stdout in a variable?

  var erl_ver = ''; 
  var e = require('child_process');
  e.exec('erl -pa ' + __dirname + ' -s shell_info get_ver -s erlang halt', function(err,stdout, stderr) {
  erl_ver = stdout;
  });

Thanks.