Skip to content

Commit

Permalink
Update lib/inspector.js
Browse files Browse the repository at this point in the history
Add devsnek suggestions

Co-authored-by: snek <[email protected]>
  • Loading branch information
ErickWendel and devsnek authored Aug 16, 2022
1 parent b1947d2 commit 31305ea
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,12 @@ class Session extends EventEmitter {
return;
}

const event = new EventEmitter();
const kOnFinish = Symbol('kOnFinish');
const promisifiedResult = promisify(event.once.bind(event))(kOnFinish);
const cb = (err, res) => event.emit(kOnFinish, err, res);
configureCbAndDispatch(cb);

return promisifiedResult;
return new Promise((resolve, reject) => {
configureCbAndDispatch((err, res) => {
if (err) reject(err);
else resolve(res);
});
});
}

/**
Expand Down

0 comments on commit 31305ea

Please sign in to comment.