Skip to content

Instantly share code, notes, and snippets.

@sidewinder12s
Forked from ThisIsMissEm/handler.js
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sidewinder12s/96b0d2a1bd92cb538e42 to your computer and use it in GitHub Desktop.
Save sidewinder12s/96b0d2a1bd92cb538e42 to your computer and use it in GitHub Desktop.
The better way to execute Go on Amazon Lambda (see: http://blog.0x82.com/2014/11/24/aws-lambda-functions-in-go/)
var child_process = require('child_process');
exports.handler = function(event, context) {
var proc = spawn('./test', [ JSON.stringify(event) ], { stdio: 'inherit' });
proc.on('close', function(code){
if(code !== 0) {
return context.done(new Error("Process exited with non-zero status code"));
}
context.done(null);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment