From 27092bdd7f97454635a52772a904e0f2120f3ade Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 16 Dec 2015 04:09:22 +0000 Subject: [PATCH] exit when complete --- example/letsencrypt.js | 4 +++- example/serve.js | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/example/letsencrypt.js b/example/letsencrypt.js index 532f53f..5bb2255 100644 --- a/example/letsencrypt.js +++ b/example/letsencrypt.js @@ -15,6 +15,7 @@ var acmeDiscoveryUrl = LeCore.stagingServerUrl; var challengeStore = require('./challenge-store'); var certStore = require('./cert-store'); var serve = require('./serve'); +var closer; var accountPrivateKeyPem = null; var domainPrivateKeyPem = null; @@ -94,6 +95,7 @@ function runDemo() { console.log('[certs]'); console.log(err || certs); + closer(); }); @@ -106,7 +108,7 @@ function runDemo() { // // Setup the Server // -serve.init({ +closer = serve.init({ LeCore: LeCore // needs a default key and cert chain, anything will do , httpsOptions: require('localhost.daplie.com-certificates') diff --git a/example/serve.js b/example/serve.js index 1f7f322..53faec4 100644 --- a/example/serve.js +++ b/example/serve.js @@ -73,4 +73,10 @@ module.exports.init = function (deps) { http.createServer(acmeResponder).listen(80, function () { console.log('Listening http on', this.address()); }); + + return function () { + // Note: we should just keep a handle on + // the servers and close them each with server.close() + process.exit(1); + }; };