diff --git a/lib/pipeline/server.js b/lib/pipeline/server.js index 172cbde9d..99c824ac9 100644 --- a/lib/pipeline/server.js +++ b/lib/pipeline/server.js @@ -12,6 +12,13 @@ class Server { } start(callback) { + if (this.server && this.server.listening) { + this.logger.warn("a webserver is already running at " + ("http://" + this.hostname + ":" + this.port).bold.underline.green); + if (callback) { + callback(); + } + return; + } let serve = serveStatic(this.dist, {'index': ['index.html', 'index.htm']}); this.server = http.createServer(function onRequest(req, res) { @@ -26,6 +33,13 @@ class Server { } stop(callback) { + if (!this.server || !this.server.listening) { + this.logger.warn("no webserver is currently running"); + if (callback) { + callback(); + } + return; + } this.server.shutdown(function() { if (callback) { callback();