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 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 otherwise.
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "concurrently",
3
- "version": "5.0.2",
3
+ "version": "5.1.0",
4
4
  "description": "Run commands concurrently",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -7,29 +7,33 @@ module.exports = class CompletionListener {
7
7
  this.scheduler = scheduler;
8
8
  }
9
9
 
10
- listen(commands) {
11
- const closeStreams = commands.map(command => command.close);
12
- const allClosed = Rx.zip(...closeStreams);
13
- return Rx.merge(...closeStreams).pipe(
14
- bufferCount(closeStreams.length),
15
- map(exitCodes => {
16
- switch (this.successCondition) {
17
- /* eslint-disable indent */
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
- case 'last':
22
- return exitCodes[exitCodes.length - 1] === 0;
19
+ default:
20
+ return exitCodes.every(exitCode => exitCode === 0);
21
+ /* eslint-enable indent */
22
+ }
23
+ }
23
24
 
24
- default:
25
- return exitCodes.every(exitCode => exitCode === 0);
26
- /* eslint-enable indent */
27
- }
28
- }),
29
- switchMap(success => success
30
- ? Rx.of(null, this.scheduler)
31
- : Rx.throwError(new Error(), this.scheduler)),
32
- take(1)
33
- ).toPromise();
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
  };