Skip to content

Commit

Permalink
fix(MongoBinary): enhance systemBinary version regex
Browse files Browse the repository at this point in the history
  • Loading branch information
hasezoey committed Jun 25, 2021
1 parent e48976d commit 0d990d3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/mongodb-memory-server-core/src/util/MongoBinary.ts
Expand Up @@ -93,7 +93,8 @@ export class MongoBinary {
log(`getPath: Spawning binaryPath "${binaryPath}" to get version`);
const spawnOutput = spawnSync(binaryPath, ['--version'])
.toString()
.match(/^db\sversion\s(v?\d+\.\d+\.\d+)$/im);
// this regex is to match the first line of the "mongod --version" output "db version v4.0.20"
.match(/^\s*db\s+version\s+v?(\d+\.\d+\.\d+)\s*$/im);

assertion(
!isNullOrUndefined(spawnOutput),
Expand Down

0 comments on commit 0d990d3

Please sign in to comment.