Skip to content

Commit 1f1b6b0

Browse files
committed
review fixes
1 parent e1639ea commit 1f1b6b0

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

packages/bson-bench/src/common.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as cp from 'child_process';
22
import { once } from 'events';
3-
import { join, sep } from 'path';
3+
import { join } from 'path';
44

55
import { exists } from './utils';
66

@@ -46,7 +46,8 @@ export class Package {
4646
this.library = match[1] as 'bson' | 'bson-ext';
4747

4848
this.localPath = match[2];
49-
this.computedModuleName = `${this.library}-local-${this.localPath.replaceAll(sep, '_')}`;
49+
this.computedModuleName = `${this.library}-local-${this.localPath.replaceAll('/', '_')}`;
50+
this.computedModuleName = `${this.library}-local-${this.localPath.replaceAll('\\', '_')}`;
5051
} else {
5152
throw new Error('unknown package specifier');
5253
}

packages/bson-bench/src/task.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,12 @@ export class Task {
194194
this.children.push(child);
195195

196196
// listen for results or error
197-
const resultOrError: ResultMessage | ErrorMessage = (await once(child, 'message'))[0];
197+
const resultOrErrorPromise = once(child, 'message');
198+
// Wait for process to exit
199+
const exit = once(child, 'exit');
198200

199-
// wait for child to close
200-
await once(child, 'exit');
201+
const resultOrError: ResultMessage | ErrorMessage = (await resultOrErrorPromise)[0];
202+
await exit;
201203

202204
this.hasRun = true;
203205
switch (resultOrError.type) {

0 commit comments

Comments
 (0)