Skip to content

Commit 0d990d3

Browse files
committed
fix(MongoBinary): enhance systemBinary version regex
1 parent e48976d commit 0d990d3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/mongodb-memory-server-core/src/util/MongoBinary.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ export class MongoBinary {
9393
log(`getPath: Spawning binaryPath "${binaryPath}" to get version`);
9494
const spawnOutput = spawnSync(binaryPath, ['--version'])
9595
.toString()
96-
.match(/^db\sversion\s(v?\d+\.\d+\.\d+)$/im);
96+
// this regex is to match the first line of the "mongod --version" output "db version v4.0.20"
97+
.match(/^\s*db\s+version\s+v?(\d+\.\d+\.\d+)\s*$/im);
9798

9899
assertion(
99100
!isNullOrUndefined(spawnOutput),

0 commit comments

Comments
 (0)