Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
Revert "use events.once"
Browse files Browse the repository at this point in the history
This reverts commit e4ab5e1.
  • Loading branch information
frangio committed Oct 21, 2020
1 parent 14dcfb9 commit fd9344c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/setup-ganache.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import path from 'path';
import { fork, ChildProcess } from 'child_process';
import events from 'events';

import { accountsConfig } from './accounts';
import config from './config';
Expand Down Expand Up @@ -50,7 +49,13 @@ export default async function (): Promise<string> {
};
server.send(options);

const [message]: Message[] = await events.once(server, 'message');
const messageReceived: Promise<Message> = new Promise(
(resolve): ChildProcess => {
return server.once('message', resolve);
},
);

const message = await messageReceived;

switch (message.type) {
case 'ready':
Expand Down

0 comments on commit fd9344c

Please sign in to comment.