@@ -574,21 +574,25 @@ export class MongoInstance extends EventEmitter implements ManagerBase {
574
574
new StdoutInstanceError ( `Port "${ this . instanceOpts . port } " already in use` )
575
575
) ;
576
576
}
577
- if ( / e x c e p t i o n i n i n i t A n d L i s t e n : \w + [ ^ : ] : .+ [ ^ , ] , t e r m i n a t i n g / i. test ( line ) ) {
578
- // in pre-4.0 mongodb this exception may have been "permission denied" and "Data directory /path not found"
579
577
580
- // this variable cannot actually be "null", because of the previous test
581
- const matches = / e x c e p t i o n i n i n i t A n d L i s t e n : ( \w + [ ^ : ] ) : ( . + [ ^ , ] ) , t e r m i n a t i n g / i. exec ( line ) ;
578
+ {
579
+ const execptionMatch = / \b e x c e p t i o n i n i n i t A n d L i s t e n : ( \w + ) : / i. exec ( line ) ;
582
580
583
- const { 1 : errorName , 2 : origError } = matches || [ ] ;
581
+ if ( ! isNullOrUndefined ( execptionMatch ) ) {
582
+ // in pre-4.0 mongodb this exception may have been "permission denied" and "Data directory /path not found"
584
583
585
- this . emit (
586
- MongoInstanceEvents . instanceError ,
587
- new StdoutInstanceError (
588
- `Instance Failed to start with "${ errorName } ". Original Error:\n` + origError
589
- )
590
- ) ;
584
+ this . emit (
585
+ MongoInstanceEvents . instanceError ,
586
+ new StdoutInstanceError (
587
+ `Instance Failed to start with "${ execptionMatch [ 1 ] ?? 'unknown' } ". Original Error:\n` +
588
+ line
589
+ . substring ( execptionMatch . index + execptionMatch [ 0 ] . length )
590
+ . replaceAll ( / , t e r m i n a t i n g $ / gi, '' )
591
+ )
592
+ ) ;
593
+ }
591
594
}
595
+
592
596
if ( / C U R L _ O P E N S S L _ 3 [ ' \s ] + n o t f o u n d / i. test ( line ) ) {
593
597
this . emit (
594
598
MongoInstanceEvents . instanceError ,
0 commit comments