node js interact with shell application

前端 未结 1 665
孤独总比滥情好
孤独总比滥情好 2020-12-30 12:59

There are plenty of node js examples on online about how to spawn a child process and then catch the result as a string for your own processing.

But...

I wan

相关标签:
1条回答
  • 2020-12-30 13:12
    var child = require('child_process');
    var ps = child.spawn('python', ['-i']);
    ps.stdout.pipe(process.stdout);
    ps.stdin.write('1+1');
    ps.stdin.end();
    

    works a treat!

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