Created
December 10, 2017 22:13
-
-
Save ytaminE/54a9217bb3abfc3574db14a13783a0f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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