Skip to content

Instantly share code, notes, and snippets.

@ytaminE
Created December 10, 2017 22:13
Show Gist options
  • Select an option

  • Save ytaminE/54a9217bb3abfc3574db14a13783a0f9 to your computer and use it in GitHub Desktop.

Select an option

Save ytaminE/54a9217bb3abfc3574db14a13783a0f9 to your computer and use it in GitHub Desktop.
const exec = require('child_process').exec;
exports.handler = function(event, context, callback) {
var url = event['url'];
var input = event['input'];
var name = event['name'];
const child = exec('curl ' + url + '>' + '/tmp/file.rb\n'+
'chmod 755 /tmp/file.rb\n'+
'./bin/ruby -r "./evaluate.rb" -e "Test.new.test ' + '\'' + name + '\'' + ',' + input + '"', (result) => {
});
// Log process stdout and stderr
child.stdout.on('data', (output) => {
callback(null, output);
});
child.stderr.on('data', console.error);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment