io.sockets.on('connection', function(socket) { function redirect(data) { socket.emit('console_data', chalk.stripColor(data)); } /*var unhook = */Hook.stdout(redirect, true); /*var unhook = */Hook.stderr(redirect, true); });
var Hook = require('hook-stdio'); // Setup up a little container variable for stderr/stdout. var messages = []; // Intercept messages passed to the stderr pipe and add them to the array of errors. function addMessage(data) { if(data) messages.push(data); } var files; //console.log('Booting compiler process...'); var unhookerr = Hook.stderr(addMessage, true); var unhookout = Hook.stdout(addMessage, true); process.on('message', function(data) { try { messages = []; fs.resetFiles(); var options; if(data.exit) { process.exit(); } if(data.options) {