I want to get the result back from a execFile call:
var http = require('http');
var fs = require('fs');
const execFile = require('child_process').execFile;
http.createServer(function (req, res) {
  fs.readFile('index.html', function(err, data) {
    res.writeHead(200, {'Content-Type': 'text/html'});
    res.write(execute());
    return res.end();
  });
}).listen(8080);
var execute = function(){
  console.log("start execution");
    let result = execFile('./demo-files/demo.sh', ['1st', '2nd', '3rd'], function(err, data){
    if(err){
      console.log("ERROR:\n" + err);
    }
    return data.toString();
  });
  return result;
}
But I'm not sure which way is the right syntax.
Surprisingly, I can't seem to find the exact post on SO with my question? If duplicate, I will happily consider the other source.
