From e0345bae86109c82129cfe25698990e930900c1c Mon Sep 17 00:00:00 2001 From: Joel Marcey Date: Tue, 24 Oct 2017 15:51:27 -0700 Subject: [PATCH] Fix port check (#173) Since the check is async, starting the server on the port was happening before the check finished. Thus even if the port wasn't being used, it would error out as if it was because the server would start it before the check was finished. This way we only start the server after the check finishes. --- lib/start-server.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/start-server.js b/lib/start-server.js index 4e089833eb..dc5491bfa1 100755 --- a/lib/start-server.js +++ b/lib/start-server.js @@ -43,9 +43,9 @@ tcpPortUsed.check(port, "localhost") chalk.red("Port " + port + " is in use") ); process.exit(1); + } else { + // start local server on specified port + const server = require("./server/server.js"); + server(port); } }); - -// start local server on specified port -const server = require("./server/server.js"); -server(port);