Skip to content
This repository has been archived by the owner on Dec 24, 2021. It is now read-only.

Commit

Permalink
Make sure to exit with non-zero exit code on hugo error
Browse files Browse the repository at this point in the history
If hugo fails to build the site, we want to make sure gulp exits
with an appropriate error code so a netlify deploy fails
  • Loading branch information
biilmann committed Oct 19, 2016
1 parent 742a266 commit 4733455
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
});
}

0 comments on commit 4733455

Please sign in to comment.