Skip to content

Instantly share code, notes, and snippets.

@TerryMooreII
Created May 2, 2014 12:11
Show Gist options
  • Save TerryMooreII/0b0ecb46d9dbe94f8860 to your computer and use it in GitHub Desktop.
Save TerryMooreII/0b0ecb46d9dbe94f8860 to your computer and use it in GitHub Desktop.
Code to execute the bash script and send the response message - Cardinal Solutions ALF blog post
var executeCommand = function(obj){
exec(obj.cmd, function(err, stdout, stderr){
var data = {
error: err,
stdout:stdout,
stderr: stderr
}
if (!writeToLog(obj.projectName, obj.service, data)){
errorResponse(response, 'Unable to write to log directory, check permissions')
}
obj.response.setHeader('Content-type', 'application/json');
obj.response.status(200).end(JSON.stringify(data));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment