From 9d8ae2aa82d175a819f95e0dc3f38e5ec4eaf6ef Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Fri, 19 Apr 2019 12:01:51 -0400 Subject: [PATCH] Return a Promise that resolves once the server has started listening --- src/main-process/atom-application.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main-process/atom-application.js b/src/main-process/atom-application.js index 1ba529feb..ccdfaeeb8 100644 --- a/src/main-process/atom-application.js +++ b/src/main-process/atom-application.js @@ -436,8 +436,10 @@ class AtomApplication extends EventEmitter { }) }) - server.listen(this.socketPath) - server.on('error', error => console.error('Application server failed', error)) + return new Promise(resolve => { + server.listen(this.socketPath, resolve) + server.on('error', error => console.error('Application server failed', error)) + }) } deleteSocketFile () {