Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
W-A-James committed Dec 6, 2024
1 parent e1639ea commit 1f1b6b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions packages/bson-bench/src/common.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as cp from 'child_process';
import { once } from 'events';
import { join, sep } from 'path';
import { join } from 'path';

import { exists } from './utils';

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

this.localPath = match[2];
this.computedModuleName = `${this.library}-local-${this.localPath.replaceAll(sep, '_')}`;
this.computedModuleName = `${this.library}-local-${this.localPath.replaceAll('/', '_')}`;
this.computedModuleName = `${this.library}-local-${this.localPath.replaceAll('\\', '_')}`;
} else {
throw new Error('unknown package specifier');
}
Expand Down
8 changes: 5 additions & 3 deletions packages/bson-bench/src/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,12 @@ export class Task {
this.children.push(child);

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

// wait for child to close
await once(child, 'exit');
const resultOrError: ResultMessage | ErrorMessage = (await resultOrErrorPromise)[0];
await exit;

this.hasRun = true;
switch (resultOrError.type) {
Expand Down

0 comments on commit 1f1b6b0

Please sign in to comment.