concurrently 5.0.2 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/completion-listener.js +26 -22
package/README.md
CHANGED
|
@@ -247,7 +247,7 @@ concurrently can be used programmatically by using the API documented below:
|
|
|
247
247
|
to use when prefixing with `time`. Default: `yyyy-MM-dd HH:mm:ss.ZZZ`
|
|
248
248
|
|
|
249
249
|
> Returns: a `Promise` that resolves if the run was successful (according to `successCondition` option),
|
|
250
|
-
> or rejects
|
|
250
|
+
> or rejects, containing an array with the exit codes of each command that has been run.
|
|
251
251
|
|
|
252
252
|
Example:
|
|
253
253
|
|
package/package.json
CHANGED
|
@@ -7,29 +7,33 @@ module.exports = class CompletionListener {
|
|
|
7
7
|
this.scheduler = scheduler;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
case 'first':
|
|
19
|
-
return exitCodes[0] === 0;
|
|
10
|
+
isSuccess(exitCodes) {
|
|
11
|
+
switch (this.successCondition) {
|
|
12
|
+
/* eslint-disable indent */
|
|
13
|
+
case 'first':
|
|
14
|
+
return exitCodes[0] === 0;
|
|
15
|
+
|
|
16
|
+
case 'last':
|
|
17
|
+
return exitCodes[exitCodes.length - 1] === 0;
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
default:
|
|
20
|
+
return exitCodes.every(exitCode => exitCode === 0);
|
|
21
|
+
/* eslint-enable indent */
|
|
22
|
+
}
|
|
23
|
+
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
listen(commands) {
|
|
26
|
+
const closeStreams = commands.map(command => command.close);
|
|
27
|
+
return Rx.merge(...closeStreams)
|
|
28
|
+
.pipe(
|
|
29
|
+
bufferCount(closeStreams.length),
|
|
30
|
+
switchMap(exitCodes =>
|
|
31
|
+
this.isSuccess(exitCodes)
|
|
32
|
+
? Rx.of(exitCodes, this.scheduler)
|
|
33
|
+
: Rx.throwError(exitCodes, this.scheduler)
|
|
34
|
+
),
|
|
35
|
+
take(1)
|
|
36
|
+
)
|
|
37
|
+
.toPromise();
|
|
34
38
|
}
|
|
35
39
|
};
|