You want to use child_process, you can use exec or spawn, depending on your needs. Exec will return a buffer (it will not live), spawn will return a stream (it will live). There are also some random quirks between them, so I am doing the funny thing I am doing to start npm.
Here's a modified example from a tool that I wrote that tried to run the npm installation for you:
var spawn = require('child_process').spawn; var isWin = /^win/.test(process.platform); var child = spawn(isWin ? 'cmd' : 'sh', [isWin?'/c':'-c', 'npm', 'install']); child.stdout.pipe(process.stdout);
source share