Beep on generation error

This commit is contained in:
Dan Holmsand 2014-01-20 09:40:56 +01:00
parent 446e05adec
commit 95389b6fde
1 changed files with 21 additions and 3 deletions

View File

@ -29,7 +29,25 @@ var generate = function () {
return fs.readFileSync(x);
}).join("\n"));
console.log('Wrote site');
}
};
var compileOk = function () {
var msg = process.argv[2];
if (msg && msg.match(/failed/)) {
console.log("Compilation failed");
// beep
console.log('\u0007');
return false;
}
return true;
};
if (compileOk()) {
console.log('Writing site');
try {
generate();
} catch (e) {
console.log('\u0007');
console.error(e.stack);
}
}