How can I invoke Ruby from Node.js?

后端 未结 1 709
醉酒成梦
醉酒成梦 2020-12-30 07:49

There are several ways for running JavaScript inside of a Ruby script. For example, there is ExecJS which is frequently used for porting NPM modules to Ruby. So, is there a

相关标签:
1条回答
  • 2020-12-30 08:31

    You can invoke Ruby like any other shell command using child_process.exec()

    var exec = require("child_process").exec;
    
    exec('ruby -e "puts \'Hello from Ruby!\'"', function (err, stdout, stderr) {
        console.log(stdout);
    });
    

    Don't know if that's what you're looking for?

    0 讨论(0)
提交回复
热议问题