aboutsummaryrefslogtreecommitdiffstats
path: root/gulpfile.babel.js
diff options
context:
space:
mode:
authorMathias Biilmann Christensen <info@mathias-biilmann.net>2016-10-18 22:40:29 -0700
committerMathias Biilmann Christensen <info@mathias-biilmann.net>2016-10-18 22:40:29 -0700
commit473345578f2977d6c4833bb930a4c8fb7fdae436 (patch)
treec87b04401b9e040084fa092f92bb1f66c1ffb893 /gulpfile.babel.js
parent742a26610cefd71c35683e66d10e327260167ec5 (diff)
Make sure to exit with non-zero exit code on hugo error
If hugo fails to build the site, we want to make sure gulp exits with an appropriate error code so a netlify deploy fails
Diffstat (limited to 'gulpfile.babel.js')
-rw-r--r--gulpfile.babel.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/gulpfile.babel.js b/gulpfile.babel.js
index b3c942c..2b62726 100644
--- a/gulpfile.babel.js
+++ b/gulpfile.babel.js
@@ -53,8 +53,13 @@ gulp.task("server", ["hugo", "css", "js"], () => {
function buildSite(cb, options) {
const args = options ? defaultArgs.concat(options) : defaultArgs;
- return cp.spawn(hugoBin, args, {stdio: "inherit"}).on("close", () => {
- browserSync.reload();
- cb();
+ return cp.spawn(hugoBin, args, {stdio: "inherit"}).on("close", (code) => {
+ if (code === 0) {
+ browserSync.reload();
+ cb();
+ } else {
+ browserSync.notify("Hugo build failed :(");
+ cb("Hugo build failed");
+ }
});
}