Browse Source

add some better log messages

pull/2/head
Brett Langdon 12 years ago
parent
commit
9940454d35
1 changed files with 8 additions and 5 deletions
  1. +8
    -5
      lib/index.js

+ 8
- 5
lib/index.js View File

@ -21,26 +21,29 @@ module.exports.tend = function(dir, rawCommand, options) {
var startCommand = function() {
console.log(('Running Command: ' + rawCommand).green);
executor = spawn(command, args);
var pid = executor.pid;
executor.stdout.on('data', function(chunk) {
console.log(('Process ' + pid + ' stdout: ').yellow);
console.log(chunk.toString());
});
executor.stderr.on('data', function(chunk) {
console.log(('Process ' + pid + ' stderr: ').yellow);
console.error(chunk.toString().red);
});
executor.on('error', function(error) {
console.error('Error Running Command'.red);
console.error(('Error Running Process ' + pid).red);
});
executor.on('close', function(code, signal) {
if (code === 0) {
console.log('Command Exited Successfully'.green);
console.log(('Process ' + pid + ' Exited Successfully').green);
} else if (signal) {
console.warn(('Command Killed With Signal: ' + signal).yellow);
console.warn(('Process ' + pid + ' Killed With Signal: ' + signal).yellow);
} else {
console.error(('Command Exited With Status: ' + code).red);
console.error(('Process ' + pid + ' Exited With Status: ' + code).red);
}
executor = null;
});
console.log(('Process ' + executor.pid + ' Started').green);
console.log(('Process ' + pid + ' Started').green);
}.bind(this);
watch.watchTree(dir, function(f, curr, prev) {


Loading…
Cancel
Save