Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit acb0b98

Browse files
committed
Allow hooks to selectively stop the CLI process
See NativeScript/nativescript-cli#1337
1 parent 84c1ce5 commit acb0b98

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

services/hooks-service.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,16 @@ export class HooksService implements IHooksService {
9999
if (maybePromise) {
100100
this.$logger.trace('Hook promises to signal completion');
101101
let hookCompletion = new Future<void>();
102-
maybePromise.then(() => hookCompletion.return(), (err: any) => hookCompletion.throw(err));
102+
maybePromise.then(
103+
() => hookCompletion.return(),
104+
(err: any) => {
105+
if (_.isBoolean(err.stopExecution) && err.stopExecution === false) {
106+
this.$logger.warn(err.message);
107+
hookCompletion.return();
108+
} else {
109+
hookCompletion.throw(err);
110+
}
111+
});
103112
hookCompletion.wait();
104113
}
105114
this.$logger.trace('Hook completed');

0 commit comments

Comments
 (0)