-
-
Save yitsushi/adf0833b1f6b5e62225a 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 sys = require("sys"), | |
spawn = require('child_process').spawn; | |
/* | |
* htmlEntities function is from Chris Coyier | |
* URL: http://css-tricks.com/snippets/javascript/htmlentities-for-javascript/ | |
*/ | |
function htmlEntities(str) { | |
return String(str).replace(/&/g, '&') | |
.replace(/</g, '<') | |
.replace(/>/g, '>') | |
.replace(/"/g, '"'); | |
} | |
(function(path, file) { | |
console.log("<div style='color: green'>Run " | |
+ path + "/" + file | |
+ "</div>"); | |
var app = spawn("node", [path + "/" + file], { cwd: path }); | |
app.stdout.on('data', function(data) { | |
console.log("<div>" | |
+ htmlEntities(data) | |
+ "</div>"); | |
}); | |
app.stderr.on('data', function(data) { | |
console.log("<div style='color: red'>" | |
+ htmlEntities(data) | |
+ "</div>"); | |
}); | |
app.on('exit', function(code) { | |
console.log('App exited with code ' + code); | |
}); | |
})(process.env.TM_DIRECTORY, 'app.js'); | |
// by Balazs Nadasdi | |
// if you find a bug then please send me to [email protected] | |
// or find me on Google+ |
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 sys = require("sys"), | |
spawn = require('child_process').spawn; | |
/* | |
* htmlEntities function is from Chris Coyier | |
* URL: http://css-tricks.com/snippets/javascript/htmlentities-for-javascript/ | |
*/ | |
function htmlEntities(str) { | |
return String(str).replace(/&/g, '&') | |
.replace(/</g, '<') | |
.replace(/>/g, '>') | |
.replace(/"/g, '"'); | |
} | |
(function(path, file) { | |
console.log("<div style='color: green'>Run " | |
+ file | |
+ "</div>"); | |
var app = spawn("node", [file], { cwd: path }); | |
app.stdout.on('data', function(data) { | |
console.log("<div>" | |
+ htmlEntities(data) | |
+ "</div>"); | |
}); | |
app.stderr.on('data', function(data) { | |
console.log("<div style='color: red'>" | |
+ htmlEntities(data) | |
+ "</div>"); | |
}); | |
app.on('exit', function(code) { | |
console.log('App exited with code ' + code); | |
}); | |
})(process.env.TM_DIRECTORY, process.env.TM_FILEPATH); | |
// by Balazs Nadasdi | |
// if you find a bug then please send me to [email protected] | |
// or find me on Google+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment