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