Avoid empty logging

- Avoid useless empty logging when stdout/stderr is empty. Using gutil.log instead of console.log.
- Formatting code
This commit is contained in:
Julien Martin
2016-02-27 22:14:44 +01:00
parent 8bc3b62c06
commit 15211c0280

View File

@@ -10,31 +10,31 @@ module.exports = function (options) {
var targetFile = nugetPath;
var cmdArgs = ["restore"];
if(options){
if (options) {
nugetPath = options.nugetPath || nugetPath;
monoPath = options.monoPath || monoPath;
if(options.additionalArgs && options.additionalArgs.length > 0){
if (options.additionalArgs && options.additionalArgs.length > 0) {
cmdArgs = cmdArgs.concat(options.additionalArgs);
}
}
if(monoPath && monoPath.length > 0){
if (monoPath && monoPath.length > 0) {
targetFile = monoPath;
cmdArgs.unshift(nugetPath);
}
return through.obj(function (file, enc, cb) {
if (!file || !file.path) {
cb(null, file);
return;
}
cmdArgs.push(file.path);
return execFile(targetFile, cmdArgs, function(error, stdout, stderror){
console.log(stdout);
console.log(stderror);
return execFile(targetFile, cmdArgs, function (error, stdout, stderror) {
if (stdout.trim()) gutil.log(stdout);
if (stderror.trim()) gutil.log(stderror);
if (error) {
throw error;
}
cb(null, file);
});
});
};