Skip to content

Commit 0bf25d9

Browse files
committed
Correct exit code for development script
Prior to this patch, when the "populate test data" script failed, it simply printed the error object and exited with a successful exit code. This made recognizing the failure difficult because the error object includes hundreds of lines of context which do not obviously indicate a problem. Signify an error has taken place using a non-zero exit code as per UNIX convention. This allows the caller to recognize the failure (and in particular, it causes the `npm` utility--which invokes this script on the user's behalf--to prominently describe the failure).
1 parent 57e0d7e commit 0bf25d9

File tree

1 file changed

+1
-0
lines changed
  • server/scripts/populate-test-data

1 file changed

+1
-0
lines changed

server/scripts/populate-test-data/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ const populateTestDatabase = async transaction => {
227227
if (require.main === module)
228228
sequelize.transaction(populateTestDatabase).catch(error => {
229229
console.error(error);
230+
process.exitCode = 1;
230231
});
231232

232233
module.exports = populateTestDatabase;

0 commit comments

Comments
 (0)