7

Is there a npm that can install and or use a ruby file as is and execute inside of node.js? I'm curious because I want want to run two different ruby scripts at the same time.

1 Answer 1

9

Really simple by using child_process#exec

var exec = require('child_process').exec

exec('./script.rb', function (error, stdout, stderr) {
  console.log('stdout: ' + stdout);
  console.log('stderr: ' + stderr);
  console.log('error: ' + error);
});

Docs here: child_process.exec

Sign up to request clarification or add additional context in comments.

1 Comment

For what it's worth, I had to call 'ruby ./script.rb', I guess it depends on how the script is set up...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.