Created
October 2, 2013 12:41
-
-
Save scarlac/6793066 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var path = require('path'), | |
fs = require('fs'), | |
sys = require('util'), | |
os = require('os'), | |
exec = require('child_process').exec, | |
child, | |
mkdirp; | |
var exitCode = 0; | |
var cmd = 'PATH="$PATH:/opt/local/bin" /opt/local/bin/lessc --source-map-inline --source-map '+process.argv.slice(1).slice(1).join(' '); | |
//console.log(cmd); | |
child = exec(cmd, // command line argument directly in string | |
function (error, stdout, stderr) { // one easy function to capture data/errors | |
if(stdout.length > 0) { | |
process.stdout.write('stdout: '+stdout); | |
process.stdout.write('line: '+cmd); | |
} | |
if(stderr.length > 0) { | |
process.stderr.write('stderr: '+stderr); | |
process.stderr.write('line: '+cmd); | |
exitCode = 1; | |
} | |
if (error !== null) { | |
exitCode = 1; | |
console.log('exec error: ' + error); | |
} | |
}); | |
process.on('exit', function() { process.reallyExit(exitCode) }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment