I have this simple script :
var exec = require(\'child_process\').exec;
exec(\'coffee -cw my_file.coffee\', function(error, stdout, stderr) {
console.lo
There are already several answers however none of them mention the best (and easiest) way to do this, which is using spawn
and the { stdio: 'inherit' } option. It seems to produce the most accurate output, for example when displaying the progress information from a git clone
.
Simply do this:
var spawn = require('child_process').spawn;
spawn('coffee', ['-cw', 'my_file.coffee'], { stdio: 'inherit' });
Credit to @MorganTouvereyQuilling for pointing this out in this comment.