File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -43,15 +43,18 @@ export class CompletionListener {
43
43
return events [ 0 ] . exitCode === 0 ;
44
44
} else if ( this . successCondition === 'last' ) {
45
45
return events [ events . length - 1 ] . exitCode === 0 ;
46
- } else if ( ! / ^ ! ? c o m m a n d - .+ $ / . test ( this . successCondition ) ) {
46
+ }
47
+
48
+ const commandSyntaxMatch = this . successCondition . match ( / ^ ! ? c o m m a n d - ( .+ ) $ / ) ;
49
+ if ( commandSyntaxMatch == null ) {
47
50
// If not a `command-` syntax, then it's an 'all' condition or it's treated as such.
48
51
return events . every ( ( { exitCode } ) => exitCode === 0 ) ;
49
52
}
50
53
51
54
// Check `command-` syntax condition.
52
55
// Note that a command's `name` is not necessarily unique,
53
56
// in which case all of them must meet the success condition.
54
- const [ , nameOrIndex ] = this . successCondition . split ( '-' ) ;
57
+ const nameOrIndex = commandSyntaxMatch [ 1 ] ;
55
58
const targetCommandsEvents = events . filter ( ( { command, index } ) => (
56
59
command . name === nameOrIndex
57
60
|| index === Number ( nameOrIndex )
You can’t perform that action at this time.
0 commit comments