最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Node.js read and execute a Ruby file? - Stack Overflow

programmeradmin2浏览0评论

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.

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.

Share Improve this question asked Apr 14, 2015 at 10:47 marriedjane875marriedjane875 6732 gold badges10 silver badges24 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 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

发布评论

评论列表(0)

  1. 暂无评论