cli/create_db: return an erroneous exit on on error
This commit is contained in:
@@ -35,12 +35,19 @@ class CreateDb extends Command {
|
||||
readWrite: true,
|
||||
);
|
||||
|
||||
bool failed = false;
|
||||
await seedData(db).then((_) {
|
||||
print("Database created successfully");
|
||||
}).catchError((error) {
|
||||
print("Error creating database: $error");
|
||||
failed = true;
|
||||
}).whenComplete(() {
|
||||
db.close();
|
||||
});
|
||||
if (failed) {
|
||||
exit(1);
|
||||
} else {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user