简体   繁体   中英

Node.js read and execute a Ruby file?

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.

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

Node.rb could also work as well

https://github.com/sinisterchipmunk/node.rb

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM