From 9940454d3583f0a131e73c42012fd6935867b27e Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Tue, 27 May 2014 20:24:18 -0400 Subject: [PATCH] add some better log messages --- lib/index.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/index.js b/lib/index.js index 87e16c7..4bbe590 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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) {