From 96d3d0e01fe0b2b8afdd72ac7f73de945e58c99c Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Tue, 24 Oct 2017 15:30:41 +0500 Subject: [PATCH] Send SIGNUSR2 on restart --- lib/serve.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/serve.js b/lib/serve.js index 5966386..a78c26c 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -11,6 +11,11 @@ module.exports = async (file, flags, restarting) => { // Ensure that the loaded files have the correct env process.env.NODE_ENV = process.env.NODE_ENV || 'development' + // Emit SIGUSR2 to signal restart to user code + if (restarting) { + process.emit('SIGNUSR2') + } + // And then load the files const module = flags.silent ? getModule(file) : log(getModule(file)) const server = serve(module)