I would like make this function return the result of the exec command in a var. How would I go about doing this?
// System Serial Number
function systemSerialNumber(response) {
console.log("Request handler 'systemSerialNumber' was called.");
exec("dmidecode -t 1 | grep 'Serial Number:' | cut -d: -f2 | sed -e 's/^[ \t]*//g'", function (error, stdout, stderr) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write(stdout);
response.end();
});
}