From 3a9f55d51f05a86966db8bcc38ec16be20d83d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86gir=20=C3=96rn=20S=C3=ADmonarson?= Date: Wed, 22 Feb 2017 11:43:12 +0000 Subject: [PATCH] Set proper exit code when cpplint.py detects lint errors. This will allow users to run node-cpplint in shell scripts and not force them to use grunt-cpplint when that is not necessary. node-cpplint src/** || echo "The C++ lint failed with exit code $?" --- lib/runner.js | 7 ++++++- package.json | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/runner.js b/lib/runner.js index 2e25e0c..c24cada 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -22,11 +22,16 @@ function runner(options, next) { /*jslint unparam:true*/ exec(args.join(' ').trim(), function (err, stdout, stderr) { - return parseOutput(stderr, next); + }).on('exit', function (exitCode) { + process.exitCode = exitCode; }); /*jslint unparam:false*/ }); } +process.on('exit', function () { + process.exit(process.exitCode); +}); + module.exports = runner; diff --git a/package.json b/package.json index 3717259..13f1c26 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,9 @@ }, "devDependencies": { "grunt": "~0.4.1", + "grunt-cli": "^1.2.0", "grunt-jslint": "~1.1.12", - "vows": "~0.7.0", - "grunt-vows": "~0.4.0" + "grunt-vows": "~0.4.0", + "vows": "~0.7.0" } }